Home

Awesome

🎄 Advent of WASM 2024

WebAssembly logo

My Advent of Code 2024 solutions in hand-crafted WebAssembly. No processing in JavaScript‒input is copied to WebAssembly and the answer is computed entirely in there.

🎯 Goals

🧩 How to use

node index.js <DAY> <PART>

For help info, try node index.js.

When running with the input, the data reported includes:

⚙️ Compile

npm install -g wat-wasm
wat2wasm <WAT_FILE> <FEATURES...>

For the list of required features, see below.

DayPart--simd
11
12
21
31
32
41
42

📝 Reports

DayPartBest runtime (μs)WASM mem usage (bytes)WASM file size (bytes)
11311.0068000473
12507.898000317
2141.8360247
3128.4950645
3243.9310915
41242.49119861552
42109.4410274

🍫 Data structures and algorithms

The table below lists non-trivial data structures and algorithms used in each solution.

DayPartData structuresAlgorithms
11ArrayInsertion sort
12Array
21
31Finite state automaton
32Finite state automaton
41ArrayTransposition
42

📔 Diary

Day 1