advent-of-code/2021
Daniel Flanagan 790f3ceaec
Port common input fetcher helpers, cleanup, and add tests
2022-12-01 12:33:06 -06:00
..
deno Organize things 2021-12-13 09:53:03 -06:00
nim Port common input fetcher helpers, cleanup, and add tests 2022-12-01 12:33:06 -06:00
rust Back to nim land? 2021-12-19 09:42:21 -06:00
zig Organize things 2021-12-13 09:53:03 -06:00
.gitignore Cleanup 2021-12-06 11:39:34 -06:00
readme.md Update readme, starting on 22 2021-12-22 12:19:21 -06:00

readme.md

2021

This year, I've been tinkering a lot with Deno as a TypeScript runtime and have been really enjoying it. I'm hoping to write this year's AoC solutions using it.

Specifically, here's my deno --version output:

$ deno --version
deno 1.16.3 (release, x86_64-unknown-linux-gnu)
v8 9.7.106.5
typescript 4.4.2

It looks like I'm also doing some of these in Nim.

$ nim --version
Nim Compiler Version 1.6.0 [Linux: amd64]
Compiled at 2021-10-19
Copyright (c) 2006-2021 by Andreas Rumpf

git hash: 727c6378d2464090564dbcd9bc8b9ac648467e38
active boot switches: -d:release

And I decided part way through to do some Rust.

$ rustc --version
rustc 1.58.0-beta.2 (0e07bcb68 2021-12-04)

Enjoy!

Usage

Run these solutions like so from their respective directories:

deno run --unstable --allow-all $DAY.ts

And the Nim ones like so:

nim c -d:release -d:ssl --run day$DAY.nim

And Rust:

rustc -O --out-dir build day$DAY.rs && ./build/day$DAY

And if you want to measure memory usage with Deno programs:

mkdir -p build
deno compile --output build/$DAY --unstable --allow-all $DAY.ts
/usr/bin/time -v ./build/$DAY

Or for Nim programs:

mkdir -p build
nim c -d:release -d:ssl --outdir:build day$DAY.nim
/usr/bin/time -v ./day$DAY

And similarly for Rust:

rustc -O --out-dir build day$DAY.rs
/usr/bin/time -v ./build/day$DAY

Days