emscripten-core / emscripten-core/emscripten
Fast Javascript WebAssembly Communication
- Dominant language
- C++
- Stars
- 27.6k
- Forks
- 3.6k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 105
Description
I created a webassembly module for accelerating vector math using SIMD and multi-threading. Multiplying 8 millions vector4 and matrix4 reveals that most time was spent on (1) JS calling C++ embind-exported function and (2) pThread communicates with main thread using MAIN_THREAD_ASYNC_EM_ASM.
To give you a idea how much time, here is a result of a sample run:
Pure Javascript 304ms,
SIMD 180ms,
SIMD with 4 threads (measured in c++) 73ms
SIMD with 8 threads (measured in c++) 50ms
SIMD with 4 threads (measured in Javascript end-to-end) 323ms
A significant amount of time (250ms) is spent on (1) and (2).
Is there current effort to improve performance of cross-boundary and inter-thread communication?
I know SharedArrayBuffer is almost instantaneous, but we need a faster way for signaling besides polling.
Thank you.
Contributor guide
Assessment
This issue has not been assessed yet.