wasm-baseline: speed up creation of stack maps
Categories
(Core :: JavaScript: WebAssembly, enhancement)
Tracking
()
Tracking | Status | |
---|---|---|
firefox111 | --- | fixed |
People
(Reporter: jseward, Assigned: jseward)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
(deleted),
text/x-phabricator-request
|
Details |
The wasm baseline compiler slows down significantly when compiling code that
has extensive need of stack maps, for example the Dart-Barista benchmark.
This is because StackMapGenerator::createStackMap spends a lot of time
iterating over a vector of booleans, one element at a time, to identify
reftyped stack slots. It is bad: for this example,
wasm::BaselineCompileFunctions costs 1175 million insns
of which StackMapGenerator::createStackMap is 701 million insns
That vector is sparsely populated -- for Dart-Barista overall, 1.1% of entries
are true
, and for most functions that number is 0.2% or less. Hence it
would be of benefit to be able to skip long runs of false
entries quickly.
Assignee | ||
Comment 1•2 years ago
|
||
The wasm baseline compiler slows down significantly when compiling code that
has extensive need of stack maps, for example the Dart-Barista benchmark.
This is because StackMapGenerator::createStackMap spends a lot of time
iterating over a vector of booleans, one element at a time, to identify
reftyped stack slots.
This patch gives class MachineStackTracker
its own iterator class Iter
to
hide the details. This provides fast(er) iteration by scanning backwards
through the vector of booleans until the scan-index becomes 8-aligned. After
that, it jumps backwards in steps of 8 elements to the extent possible.
For a --no-threads --wasm-compiler=baseline compilation only of Barista 3,
this reduces compilation time from 0.110 to 0.082 user seconds (Intel Core i5
1135G7).
Comment 3•2 years ago
|
||
bugherder |
Description
•