WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
225223
Optimize SortedArrayMap by using linear search for small arrays
https://bugs.webkit.org/show_bug.cgi?id=225223
Summary
Optimize SortedArrayMap by using linear search for small arrays
Darin Adler
Reported
2021-04-29 19:17:55 PDT
Optimize SortedArrayMap by using linear search for small arrays
Attachments
Patch
(8.85 KB, patch)
2021-04-29 19:21 PDT
,
Darin Adler
no flags
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Darin Adler
Comment 1
2021-04-29 19:21:09 PDT
Created
attachment 427396
[details]
Patch
Yusuke Suzuki
Comment 2
2021-04-29 22:02:01 PDT
Comment on
attachment 427396
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=427396&action=review
r=me
> Source/WTF/wtf/SortedArrayMap.h:145 > + if (std::size(m_array) < binarySearchThreshold) {
How about making it `if constexpr` to ensure that this dispatching is done at compile time.
> Source/WTF/wtf/SortedArrayMap.h:177 > + if (std::size(m_array) < binarySearchThreshold)
Ditto.
Darin Adler
Comment 3
2021-04-30 08:57:57 PDT
Comment on
attachment 427396
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=427396&action=review
>> Source/WTF/wtf/SortedArrayMap.h:145 >> + if (std::size(m_array) < binarySearchThreshold) { > > How about making it `if constexpr` to ensure that this dispatching is done at compile time.
Tried if constexpr first. The compiler gave an error saying that I could not use "this" in it, so I would have had to find some way to get the size from the type rather than from m_array. Decided to leave it non-constexpr; still gets constant-folded.
Darin Adler
Comment 4
2021-04-30 08:58:49 PDT
Comment on
attachment 427396
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=427396&action=review
>>> Source/WTF/wtf/SortedArrayMap.h:145 >>> + if (std::size(m_array) < binarySearchThreshold) { >> >> How about making it `if constexpr` to ensure that this dispatching is done at compile time. > > Tried if constexpr first. The compiler gave an error saying that I could not use "this" in it, so I would have had to find some way to get the size from the type rather than from m_array. Decided to leave it non-constexpr; still gets constant-folded.
If you help me find a clean simple way for me to move to if constexpr without making the code ugly, would be happy to come back and do that later.
EWS
Comment 5
2021-04-30 09:02:59 PDT
Committed
r276840
(
237191@main
): <
https://commits.webkit.org/237191@main
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 427396
[details]
.
Radar WebKit Bug Importer
Comment 6
2021-04-30 09:03:27 PDT
<
rdar://problem/77385092
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug