# An Elm REPL for my phone

**URL:** https://discourse.elm-lang.org/t/an-elm-repl-for-my-phone/9991
**Category:** Show and Tell
**Created:** [September 29, 2024, 7:35am UTC](https://discourse.elm-lang.org/t/an-elm-repl-for-my-phone/9991 "2024-09-29T07:35:07Z")
**Posts on this page:** 1
**Showing post:** 10

<div class="post-metadata">

### Author: ![marcw](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/marcw/32/4937_2.png) [@marcw](https://discourse.elm-lang.org/u/marcw)
#### Post date: [October 11, 2024, 7:06am UTC](https://discourse.elm-lang.org/t/an-elm-repl-for-my-phone/9991/10 "2024-10-11T07:06:31Z")

</div>

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](https://github.com/guida-lang/compiler) and [pithub](https://github.com/pithub/elm-compiler-in-elm-ui)
- ~1.5M GHC-wasm build of [marc136](https://github.com/marc136/elm-compiler-wasm)

But this comparison is unfair, because the Elm implementations

1. were not compiled with the `--optimize` flag. They both contain `Debug` statements, so they will be smaller and faster without those.
2. contain more functionality: `init`, `install`, `repl`. The wasm compiler only runs different variants of `make`.

## Longer

- I used swc/core as recommended by lydell in [Elm Minification Benchmarks](https://discourse.elm-lang.org/t/elm-minification-benchmarks/9968) for the `*.swc.js` files.
- I used this version of [GHC-wasm](https://gitlab.haskell.org/ghc/ghc-wasm-meta/-/tree/a04cc1a2206d2030326e1d49be9c6a94ee4283a3)

```auto
> 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.

```

---

_[View the full topic](https://discourse.elm-lang.org/t/an-elm-repl-for-my-phone/9991)._
