|
1 | 1 | # Web49
|
2 | 2 |
|
3 |
| -Web49 contains a few tools for working with webassembly |
| 3 | +Web49 contains a few tools for working with WebAssembly. |
4 | 4 |
|
5 |
| -## miniwasm |
| 5 | +* interpreters |
| 6 | + * miniwasm |
| 7 | + * [fast](#benchmarks) wasm interpreter |
| 8 | + * uses technology from [minivm](https://github.com/fastvm/minivm) |
| 9 | + * suports multiple wasm formats |
| 10 | + * wasm binary format: ~100% complete |
| 11 | + * wasm text format: ~95% complete |
| 12 | + * wasm spect test: ~75% complete |
| 13 | + * includes a custom [WASI](https://github.com/webassembly/wasi) [implementation](src/api/wasi.c) |
| 14 | + * raywasm |
| 15 | + * wasm interpreter based on miniwasm |
| 16 | + * includes [raylib](https://github.com/raysan5/raylib) [bindings](src/api/raylib.c) [generated from](src/api/raylib.py) [json](src/api/raylib.json) |
| 17 | +* wasm binary tools rewrite |
| 18 | + * much simpler than WABT's tools |
| 19 | + * much smaller than Binaryen's tools |
| 20 | + * [wat2wasm](main/wat2wasm.c) |
| 21 | + * convert wasm text into wasm binary |
| 22 | + * [wasm2wat](main/wasm2wat.c) |
| 23 | + * generates nearly identical wat as binaryen or wabt |
| 24 | + * turn wasm binary into wasm text |
| 25 | + * supports all of wasm 1.0 and some extensions |
| 26 | + * [wasm2wasm](main/wasm2wasm.c) |
| 27 | + * shrink numbers in wasm files generated by llvm |
| 28 | + * saves 0-4 bytes per 32 bit number |
| 29 | + * saves 0-10 bytes per 64 bit number |
| 30 | + * round trip parse and reemit |
6 | 31 |
|
7 |
| -MiniWASM applies what was learned in developing MiniVM to a webassembly intepreter. |
| 32 | +## Benchmarks |
8 | 33 |
|
9 |
| -MiniVM was about 2x faster than Wasm3, with more types and more dynamism. |
10 |
| -MiniVM was natively a register-only machine, and MiniWASM too will be mostly registers. |
| 34 | +Benchmarks performed by [wasm3](https://github.com/wasm3/wasm3) and miniwasm. Ran on an 2020 Macbook Air (M1 + 8GiB ram) using [bench.py](bench.py). |
11 | 35 |
|
12 |
| -MiniWASM intends to support all of what people use today in webassembly, tho it is still under heavy development. |
| 36 | +All Benchmarks compiled with: `emcc -O2` |
13 | 37 |
|
14 |
| -## wasm2wat |
| 38 | +One can also view results run on [github actions](https://github.com/FastVM/Web49/actions) |
| 39 | +One can run the benchmarks for themselves. |
15 | 40 |
|
16 |
| -The wasm2wat tool is a faster rewrite of wabt's wasm2wat, doing only the bare minimum for now. |
| 41 | +* python3 |
| 42 | + * with pip |
| 43 | +* make |
| 44 | + * tested with GNUMake |
| 45 | + * works with BSDMake too |
| 46 | +* and a C compiler |
| 47 | + * gcc/clang/tcc works |
| 48 | + * msvc would work if someone rewrites two macros |
| 49 | + * #define NEXT() break |
| 50 | + * #define LABEL(X) case X: |
| 51 | + * probably a couple others |
17 | 52 |
|
18 |
| -## wat2wasm |
| 53 | +```sh |
| 54 | +git clone https://github.com/fastvm/web49 |
| 55 | +cd web49 |
| 56 | +make CC=gcc # gcc is fastest in my tests |
| 57 | +python3 -m pip install matplotlib |
| 58 | +python3 bench.py |
| 59 | +``` |
19 | 60 |
|
20 |
| -The wat2wasm tool is a much faster rewrite of wabt's wat2wasm, it does not handle names correctly yet. |
| 61 | +### [Binary Trees](test/bench/binary-trees.c) |
| 62 | + |
21 | 63 |
|
22 |
| -## wasm2wasm |
| 64 | +### [Coremark](test/bench/coremark.c) |
| 65 | + |
23 | 66 |
|
24 |
| -The wasm2wasm tool intends to do the same thing as a round trip to the text format and back. Effectivly seeing the binary as it is seen by miniwasm/wasm2wat= |
| 67 | +### [Fannkuch Redux](test/bench/fannkuch-redux.c) |
| 68 | + |
25 | 69 |
|
26 |
| -# whoami |
| 70 | +### [Fibonacci on ints32_t](test/bench/fib_i32.c) |
| 71 | + |
27 | 72 |
|
28 |
| -I am Shaw Summa, of MiniVM fame. |
| 73 | +### [Mandelbrot with SIMD](test/bench/mandelbrot-simd.c) |
| 74 | + |
| 75 | + |
| 76 | +### [Mandelbrot without SIMD](test/bench/mandelbrot.c) |
| 77 | + |
| 78 | + |
| 79 | +### [Nbody](test/bench/nbody.c) |
| 80 | + |
| 81 | + |
| 82 | +### [Executing A Trap](test/bench/trap.c) |
| 83 | + |
0 commit comments