[webkit-changes] [WebKit/WebKit] 7d2228: [JSC] Shrink policy must be asymmetry to expand po...

Yusuke Suzuki noreply at github.com
Mon Sep 30 09:28:03 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 7d22285d572d20184291e7c210481ab3c56fa434
      https://github.com/WebKit/WebKit/commit/7d22285d572d20184291e7c210481ab3c56fa434
  Author: Yusuke Suzuki <ysuzuki at apple.com>
  Date:   2024-09-30 (Mon, 30 Sep 2024)

  Changed paths:
    A JSTests/microbenchmarks/set-delete-add.js
    M Source/JavaScriptCore/runtime/OrderedHashTableHelper.h

  Log Message:
  -----------
  [JSC] Shrink policy must be asymmetry to expand policy
https://bugs.webkit.org/show_bug.cgi?id=280600
rdar://136912759

Reviewed by Yijia Huang.

Changing OrderedHashTableHelper::shrinkIfNeeded policy from >> 2 to >> 3
since expand policy for small table is << 2. Shrink policy must be
asymmetry to the expand policy, otherwise, we have thrashing behavior of
repeated expand and shrink with one entry addition and deletion.
>> 3 is fine as we normally use / 6 in WTF::HashTable for example.
I also adjust expandIfNeeded code to avoid using float.

                               ToT                     Patched

    set-delete-add      635.0390+-16.6071    ^     40.6197+-2.6151        ^ definitely 15.6338x faster

* JSTests/microbenchmarks/set-delete-add.js: Added.
* Source/JavaScriptCore/runtime/OrderedHashTableHelper.h:
(JSC::OrderedHashTableHelper::expandIfNeeded):
(JSC::OrderedHashTableHelper::shrinkIfNeeded):
(JSC::OrderedHashTableHelper::removeImpl):
(JSC::OrderedHashTableHelper::shrinkIfNeed): Deleted.

Canonical link: https://commits.webkit.org/284450@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list