Jonathan Hale

Results 87 comments of Jonathan Hale

> The MSVC STL does an allocation in the default constructor of std::set? That's surprising... @kripken Yes, stack trace is as follows with links to he Microsoft STL repository: -...

I found another interesting bottleneck where all threads seem to be blocked by I/O in one of the threads, a millisecond or more at a time, alternating between all threads...

Replacing the trap() (that throws the except) with `return Flow(NONCONSTANT_FLOW)` seems to work perfectly fine and removes all those stalls.

Finally, it seems like there is a couple of chunks of 1 second + where all the threads wait for work to complete on one of the workers. Investigating if...

Amazing, will have time create those PRs tomorrow evening CEST then!

While not throwing an exception saves a few milliseconds and makes the profiles look much nicer, it's not really significant compared to the 16000 - 20000 milliseconds the entire wasm-opt...

And the preallocation while in theory should be an improvement, is not significant enough to escape the variance in the timing results 🤔

After some more hours of investigation, I found another thing: `Function` in wasm.h is using 7 `std::set` and `std::unordered_map`, which for my case is being allocated 4799 times (potentially more...

Here's the benchmarks (edited for readability), script, input wasm and the executables can be found [here](https://drive.google.com/file/d/1EueEr6Htlb1jjYor2dZg3fIDwQdXpEdK/view?usp=sharing) ```sh $ ./run-wasm-opt.sh wasm-opt-baseline: real 0m23.973s wasm-opt-no-set-allocation: real 0m23.209s wasm-opt-smallset-10: real 0m18.224s wasm-opt-smallset-4: real...

@kripken Sounds great! I updated this PR to use `1` instead of `10`!