This repository provides some examples and benchmarks of WebAssembly implementation compiled from various languages.
Note that WebAssembly is not always faster than JavaScript. It depends on the tasks.
Examples implement the Sieve of Eratosthenes which algorithm is old but very simple and calculate the max prime below given "N".
Check my git-pages (https://t-katsumura.github.io/webassembly-examples-eratosthenes/).
How to compile or how to run the examples are briefly described there.
Demos are available for these languages.
To compare the performance between WebAssembly and JavaScript, there are also demos of JavaScript and TypeScript.
- C (Compiled with emcc)
- C++ (Compiled with em++)
- Go (Compiled with Go)
- Go (Compiled with TinyGo)
- Rust (Compiled with wasm-pack)
- AssemblyScript (Compiled with asc)
- Java (Compiled with JWebAssembly)
- Python (Using pyodide WASM interpreter)
- TypeScript (Not WASM)
- JavaScript (Not WASM)
Any contributions are always be appreciated!
- Fork it
- Create feature branch (
git checkout -b <your branch name>
) - Develop on the branch
- Commit your changes (
git commit -m "<commit comment>"
) - Push to the branch (
git push -u origin <your branch name>
) - Create new Pull Request on Github
Git pages are created using docusaurus.
When updating the pages,
- change or add markdown in
website/docs/
- resources of demos are in
website/static/demos/
- check the updates with
npm run start
- run
npm run build
to generate static pages indocs/
- finally push your updates