emscripten-core / emscripten-core/emscripten
Fastcomp vs upstream performance
- Dominant language
- C++
- Stars
- 27.6k
- Forks
- 3.6k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 105
Description
Hello, we've been running under the old fastcomp branch for a while with great performance, and I'm trying to switch over to upstream but running into a performance issue. We've found that upstream is performing ~3.5x *slower* in our use case and I can't explain what's happening.
One difference I've seen is that upstream seems to be repeatedly re-calling the same function whereas fastcomp only makes a single call. I can't figure out how to prevent this from happening.
Here's what we can see in fastcomp, note that we have single, uninterrupted calls:

However, you can see that upstream seems to be splitting the functions and weaving different calls:

For our fastcomp builds, we used the following parameters via Makefile:
`--bind -O2 --llvm-opts 2 -s FETCH=1 -s BUILD_AS_WORKER=1 -s ALLOW_MEMORY_GROWTH=1 -s ASSERTIONS=1 -s ABORTING_MALLOC=0 -s TOTAL_MEMORY=250MB -s BINARYEN_TRAP_MODE=clamp -std=c++11`
For upstream, we use the following parameters via CMakeLists:
`-lembind -O3 -flto=thin -std=c++11 -s WASM=1 -s FETCH=1 -s BUILD_AS_WORKER=1 -s ALLOW_MEMORY_GROWTH=1 -s ASSERTIONS=1 -s ABORTING_MALLOC=0 -s TOTAL_MEMORY=250MB`
Is there something I'm missing? I've been digging through the documentation and trying different combinations to try and close the gap, but haven't been successful yet. Any help is appreciated!
Contributor guide
Assessment
This issue has not been assessed yet.