WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
237117
Small optimizations to TinyLRUCache
https://bugs.webkit.org/show_bug.cgi?id=237117
Summary
Small optimizations to TinyLRUCache
Chris Dumez
Reported
2022-02-23 15:25:47 PST
Small optimizations to TinyLRUCache.
Attachments
Patch
(2.97 KB, patch)
2022-02-23 15:31 PST
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Patch
(2.96 KB, patch)
2022-02-23 18:06 PST
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Chris Dumez
Comment 1
2022-02-23 15:31:24 PST
Created
attachment 453035
[details]
Patch
Darin Adler
Comment 2
2022-02-23 17:48:15 PST
Comment on
attachment 453035
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=453035&action=review
> Source/WTF/ChangeLog:14 > + - Use Vector::uncheckedAppend() instead of Vector::append() to bypass capacity > + checks given that the vector has an inline capacity that is the size of the > + cache (vector capacity never grows or shrinks).
Maybe we should us FixedVector instead?
> Source/WTF/wtf/TinyLRUCache.h:56 > + Entry entry = WTFMove(m_cache[index]);
I’d use auto here.
Chris Dumez
Comment 3
2022-02-23 17:58:23 PST
Comment on
attachment 453035
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=453035&action=review
>> Source/WTF/ChangeLog:14 >> + cache (vector capacity never grows or shrinks). > > Maybe we should us FixedVector instead?
I am not super familiar with FixedVector but doesn't it have a fixed size? Here the vector size is dynamic but the vector *capacity* is static. I guess we could use a vector of fixed size (FixedVector) but then we'd need to fill the vector with "empty" values, distinguishable from actually cache values?
>> Source/WTF/wtf/TinyLRUCache.h:56 >> + Entry entry = WTFMove(m_cache[index]); > > I’d use auto here.
OK.
Chris Dumez
Comment 4
2022-02-23 18:06:00 PST
Created
attachment 453062
[details]
Patch
EWS
Comment 5
2022-02-24 00:56:50 PST
Committed
r290415
(
247723@main
): <
https://commits.webkit.org/247723@main
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 453062
[details]
.
Radar WebKit Bug Importer
Comment 6
2022-02-24 00:57:21 PST
<
rdar://problem/89405387
>
Sam Weinig
Comment 7
2022-03-04 17:09:34 PST
(In reply to Chris Dumez from
comment #3
)
> Comment on
attachment 453035
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=453035&action=review
> > >> Source/WTF/ChangeLog:14 > >> + cache (vector capacity never grows or shrinks). > > > > Maybe we should us FixedVector instead? > > I am not super familiar with FixedVector but doesn't it have a fixed size? > Here the vector size is dynamic but the vector *capacity* is static. > I guess we could use a vector of fixed size (FixedVector) but then we'd need > to fill the vector with "empty" values, distinguishable from actually cache > values? > > >> Source/WTF/wtf/TinyLRUCache.h:56 > >> + Entry entry = WTFMove(m_cache[index]); > > > > I’d use auto here. > > OK.
Given the name (Tiny...) I think we can probably just a fixed size array for this. Im don't think we ever use this for something with more than 32 elements and we know the max capacity at compile time.
Geoffrey Garen
Comment 8
2022-03-04 17:33:26 PST
std::array or whatever would be fine. Just a bother to have to implement your own size(), remove(), and append() functions. Maybe not worth the bother?
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