• Clemens Backes's avatar
    [wasm] Fix performance bottleneck in DisjointAllocationPool · 7e0279fa
    Clemens Backes authored
    When compiling modules with many functions, the list of regions in the
    {DisjointAllocationPool} can become quite large if the functions die in
    a random order (which they typically do, since the order of Liftoff
    compilation is different than the order to TurboFan compilation; which
    work stealing, both are nondeterministic).
    Iterating the list of regions in the {DisjointAllocationPool} was thus
    linear in the number of regions, which is linear in the number of
    functions of the module. Since we insert new regions one by one, overall
    runtime was quadratic.
    
    This CL fixes this by switching from a linked list to a std::set.
    Merging a new region is thus logarithmic instead of linear, and overall
    we are {n*log(n)} instead of {n^2}.
    
    Note: For {AllocateInRegion} we still need to linearly iterate all
    regions that overlap the requested region, but this has not shown to be
    a problem so far.
    
    R=ahaas@chromium.org
    
    Bug: v8:10432
    Change-Id: I193e56c2abab782e386194fbe64dadfa250916f7
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2154797
    Commit-Queue: Clemens Backes <clemensb@chromium.org>
    Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#67303}
    7e0279fa
Name
Last commit
Last update
..
OWNERS Loading commit data...
control-transfer-unittest.cc Loading commit data...
decoder-unittest.cc Loading commit data...
function-body-decoder-unittest.cc Loading commit data...
leb-helper-unittest.cc Loading commit data...
loop-assignment-analysis-unittest.cc Loading commit data...
module-decoder-unittest.cc Loading commit data...
streaming-decoder-unittest.cc Loading commit data...
trap-handler-posix-unittest.cc Loading commit data...
trap-handler-win-unittest.cc Loading commit data...
trap-handler-x64-unittest.cc Loading commit data...
wasm-code-manager-unittest.cc Loading commit data...
wasm-compiler-unittest.cc Loading commit data...
wasm-gdbserver-unittest.cc Loading commit data...
wasm-macro-gen-unittest.cc Loading commit data...
wasm-module-builder-unittest.cc Loading commit data...
wasm-module-sourcemap-unittest.cc Loading commit data...