[webkit-reviews] review granted: [Bug 222658] Limit HashTable entry size to 500 bytes : [Attachment 422121] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Mar 3 11:40:31 PST 2021


Yusuke Suzuki <ysuzuki at apple.com> has granted Alex Christensen
<achristensen at apple.com>'s request for review:
Bug 222658: Limit HashTable entry size to 500 bytes
https://bugs.webkit.org/show_bug.cgi?id=222658

Attachment 422121: Patch

https://bugs.webkit.org/attachment.cgi?id=422121&action=review




--- Comment #3 from Yusuke Suzuki <ysuzuki at apple.com> ---
Comment on attachment 422121
  --> https://bugs.webkit.org/attachment.cgi?id=422121
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=422121&action=review

r=me

> Source/WebCore/ChangeLog:14
> +	   Moving large structures inside HashTables is slower than just moving
a pointer.
> +	   There is a point at which it becomes more efficient to add a
separate allocation
> +	   rather than have gigantic HashTables that use all that memory for
each empty slot
> +	   and use all those read and write operations to move when rehashing. 
I'm not sure
> +	   exactly where that point is, but I'm pretty sure it's less than 500
bytes.	This
> +	   introduces a limit and removes the two largest HashTables in WebKit,
replacing their
> +	   values with std::unique_ptr to save memory and time.

Totally right. Furthermore, HashTable allocates large spaces to keep O(1)
access. If entry size is large, we waste much more memory than using a pointer.


More information about the webkit-reviews mailing list