• Kenton Varda's avatar
    ThreadDataTable: Change global linked list to per-Isolate hash map. · b49206de
    Kenton Varda authored
    For use cases with a large number of threads or a large number of isolates (or
    both), ThreadDataTable can be a major performance bottleneck due to O(n)
    lookup time of the linked list. Switching to a hash map reduces this to O(1).
    
    Example 1: Sandstorm.io, a Node.js app that utilizes "fibers", was observed
    spending the majority of CPU time iterating over the ThreadDataTable.
    See: https://sandstorm.io/news/2016-09-30-fiber-bomb-debugging-story
    
    Example 2: Cloudflare's Workers engine, a high-multi-tenancy web server
    framework built on V8 (but not Node), creates large numbers of threads and
    isolates per-process. It saw a 34x improvement in throughput when we applied
    this patch.
    
    Cloudflare has been using a patch in production since the Workers launch which
    replaces the linked list with a hash map -- but still global.
    
    This commit builds on that but goes further and creates a separate hash map
    and mutex for each isolate, with the table being a member of the Isolate
    class. This avoids any globals and should reduce lock contention.
    
    Bug: v8:5338
    Change-Id: If0d11509afb2e043b888c376e36d3463db931b47
    Reviewed-on: https://chromium-review.googlesource.com/1014407Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
    Commit-Queue: Yang Guo <yangguo@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#52753}
    b49206de
Name
Last commit
Last update
benchmarks Loading commit data...
build_overrides Loading commit data...
docs Loading commit data...
gni Loading commit data...
include Loading commit data...
infra Loading commit data...
samples Loading commit data...
src Loading commit data...
test Loading commit data...
testing Loading commit data...
third_party Loading commit data...
tools Loading commit data...
.clang-format Loading commit data...
.editorconfig Loading commit data...
.git-blame-ignore-revs Loading commit data...
.gitignore Loading commit data...
.gn Loading commit data...
.vpython Loading commit data...
.ycm_extra_conf.py Loading commit data...
AUTHORS Loading commit data...
BUILD.gn Loading commit data...
CODE_OF_CONDUCT.md Loading commit data...
ChangeLog Loading commit data...
DEPS Loading commit data...
LICENSE Loading commit data...
LICENSE.fdlibm Loading commit data...
LICENSE.strongtalk Loading commit data...
LICENSE.v8 Loading commit data...
LICENSE.valgrind Loading commit data...
OWNERS Loading commit data...
PRESUBMIT.py Loading commit data...
README.md Loading commit data...
WATCHLISTS Loading commit data...
codereview.settings Loading commit data...
snapshot_toolchain.gni Loading commit data...