Bug 1836974 Comment 12 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

Thanks, with these instructions I was able to build it. It turns out the overhead wasn't coming from the bindings, it was coming from C++ exception support. The `EMCXXFLAGS_BASE` flags contain `-s "DISABLE_EXCEPTION_CATCHING=0"` which engages a very slow mode in which every C++ call is wrapped in a JS call.

Replacing `-s "DISABLE_EXCEPTION_CATCHING=0"` with `-fwasm-exceptions` (and adding `-O3` for good measure) appears to result in a 40x speedup. Whether that's fast enough to ship, I don't know.

Here's a profile showing both the fast and the slow version running at the same time (fast on the main thread): https://share.firefox.dev/3oVBnde
Thanks, with these instructions I was able to build it. It turns out the overhead wasn't coming from the bindings, it was coming from C++ exception support. The `EMCXXFLAGS_BASE` flags contain `-s "DISABLE_EXCEPTION_CATCHING=0"` which engages a very slow mode in which every C++ call is wrapped in a JS call.

Replacing `-s "DISABLE_EXCEPTION_CATCHING=0"` with `-fwasm-exceptions` (and adding `-O3` for good measure) appears to result in a 40x speedup. Whether that's fast enough to ship, I don't know.

Here's a profile showing both the fast and the slow version running at the same time (fast on the main thread): https://share.firefox.dev/3oVBnde

Here's how I tested my changes: https://gist.github.com/mstange/826733694546bd60d0e368feb2d40646

Back to Bug 1836974 Comment 12