emscripten-core / emscripten-core/emscripten

Is WebAssembly slower than NaCl ?

Open
#12,989 6 comments 2 reactions 0 assignees View on GitHub
wontfix
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

We have a chrome extension written in C++ and Javascript. The extension uses Chrome's [NaCl](https://developer.chrome.com/native-client) sandbox for running compiled C++ code in the browser efficiently and securely.
Recently, we started migrating the extension to make use of WebAssembly instead of NaCl. For that, we used Emscripten compiler v2.0.7 to compile C++ code. Without modifying the C++ code and using the same optimisation level during compilation, we found that WebAssembly build is slower than the NaCl build.

While analysing the performance degradation on the WebAssembly build, I found `goto` statement is one of the root cause.
I prepared a simple Chrome extensions using
[NaCl](https://github.com/emscripten-core/emscripten/files/5655306/goto_NaCl_Extension.zip) and
[WebAssembly](https://github.com/emscripten-core/emscripten/files/5655310/goto_WASM_Extension.zip)
which uses `goto` statement to simulate the loop iteration.
Result shows that NaCl build is faster than the WebAssembly build.

Hereby, I want to know whether migrating to WebAssembly results in performance degradation w.r.t. NaCl ?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.