WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
101667
Improve effectiveness of function-level caching
https://bugs.webkit.org/show_bug.cgi?id=101667
Summary
Improve effectiveness of function-level caching
Oliver Hunt
Reported
2012-11-08 16:57:21 PST
Improve effectiveness of function-level caching
Attachments
Patch
(16.38 KB, patch)
2012-11-08 17:01 PST
,
Oliver Hunt
fpizlo
: review+
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Oliver Hunt
Comment 1
2012-11-08 17:01:25 PST
Created
attachment 173150
[details]
Patch
Oliver Hunt
Comment 2
2012-11-08 17:13:08 PST
Committed
r133975
: <
http://trac.webkit.org/changeset/133975
>
Darin Adler
Comment 3
2012-11-08 18:03:58 PST
Comment on
attachment 173150
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=173150&action=review
> Source/JavaScriptCore/runtime/CodeCache.h:55 > +template <typename KeyType, typename EntryType, int CacheSize> class Thingy {
Thingy? No, please use a real name. RandomEvictionCache maybe?
> Source/JavaScriptCore/runtime/CodeCache.h:59 > + : m_randomGenerator((static_cast<uint32_t>(randomNumber() * UINT32_MAX)))
Incorrect indentation here.
> Source/JavaScriptCore/runtime/CodeCache.h:76 > + size_t newIndex = m_randomGenerator.getUint32() % CacheSize;
This is not an even distribution across the cache; it will be slightly biased towards lower numbers unless the cache size is a power of 2. It would be better to make WeakRandom have a function to help you get even distribution.
Oliver Hunt
Comment 4
2012-11-08 18:43:21 PST
(In reply to
comment #3
)
> (From update of
attachment 173150
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=173150&action=review
> > > Source/JavaScriptCore/runtime/CodeCache.h:55 > > +template <typename KeyType, typename EntryType, int CacheSize> class Thingy { > > Thingy? No, please use a real name. RandomEvictionCache maybe?
Doh!
> > > Source/JavaScriptCore/runtime/CodeCache.h:59 > > + : m_randomGenerator((static_cast<uint32_t>(randomNumber() * UINT32_MAX))) > > Incorrect indentation here.
Whoops
> > > Source/JavaScriptCore/runtime/CodeCache.h:76 > > + size_t newIndex = m_randomGenerator.getUint32() % CacheSize; > > This is not an even distribution across the cache; it will be slightly biased towards lower numbers unless the cache size is a power of 2. It would be better to make WeakRandom have a function to help you get even distribution.
The bias is not the worst thing in the world, adding the branches to get unbiased behaviour seems overkill.
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