I started with a few tests over the past week and don’t want this thread to close while I’m away on the weekend, so I will now post already a naive size comparison
Naive size comparison overview
As an overview, I got these download sizes (gzipped) of the compilers:
- ~200K for each of the two Elm implementations guida-lang and pithub
- ~1.5M GHC-wasm build of marc136
But this comparison is unfair, because the Elm implementations
- were not compiled with the
--optimize
flag. They both containDebug
statements, so they will be smaller and faster without those. - contain more functionality:
init
,install
,repl
. The wasm compiler only runs different variants ofmake
.
Longer
- I used swc/core as recommended by lydell in Elm Minification Benchmarks for the
*.swc.js
files. - I used this version of GHC-wasm
> git submodule
51cdc1a4e4488828d531cbdcf6b2e935d70b8826 compiler/guida (heads/master)
4ea648a53149451b4942a84ac72ebfde24b718e9 compiler/marc136 (heads/main-wasm)
7823c804c3895a1ab962c8a3a347b9752467aa18 compiler/pithub (heads/main)
# 1st compiler
[4.0K] compiler/guida/bin/
├── [3.3M] guida.debug.js
├── [412K] guida.debug.js.gz
├── [3.3M] guida.js
├── [412K] guida.js.gz
├── [843K] guida.swc.js
├── [206K] guida.swc.js.gz
└── [ 11K] index.js
# 2nd compiler
[4.0K] compiler/pithub/dist/
├── [ 216] eval-elm.js
├── [4.2K] favicon.ico
├── [3.1M] index.debug.js
├── [445K] index.debug.js.gz
├── [ 289] index.html
├── [2.9M] index.js
├── [413K] index.js.gz
├── [744K] index.swc.js
├── [204K] index.swc.js.gz
├── [ 27K] source-code-pro.ttf
├── [ 34K] source-sans-pro.ttf
└── [3.1K] styles.css
# 3rd compiler
[4.0K] compiler/marc136/dist
├── [4.6K] repl.js
├── [4.8M] repl.opt.wasm
├── [1.3M] repl.opt.wasm.gz
├── [6.3M] repl.wasm
├── [1.4M] repl.wasm.gz
├── [4.6K] ulm.js
├── [5.2M] ulm.opt.wasm
├── [1.4M] ulm.opt.wasm.gz
├── [ 10M] ulm.wasm
└── [1.7M] ulm.wasm.gz
To create the `.opt.wasm` builds, I use `wasm-opt`, but for some commits of ghc-wasm-meta it fails to parse the initial wasm output.
The 1.4M of ulm.opt.tar.gz is what would be downloaded in the browser, and it would
execute the 5.2M.