This commit is contained in:
Daniel Flanagan 2021-12-06 11:39:34 -06:00
parent 13042e1de2
commit e9f39ca27a
Signed by: lytedev
GPG key ID: 5B2020A0F9921EF4
3 changed files with 31 additions and 10 deletions

1
2021/.gitignore vendored
View file

@ -1,2 +1,3 @@
*.input *.input
build build
zig-cache

7
2021/6.zig Normal file
View file

@ -0,0 +1,7 @@
const std = @import("std");
// TODO: solution to day 6
pub fn main() !void {
const stdout = std.io.getStdOut().writer();
try stdout.print("Hello, {s}!\n", .{"world"});
}

View file

@ -12,7 +12,9 @@ Specifically, here's my `deno --version` output:
Enjoy! Enjoy!
**EDIT**: Since performance is not what I would like, it looks like I'm also doing some of these in nim. **EDIT**: Since performance is not what I would like, it looks like I'm also doing some of these in Nim.
**EDIT 2**: I sprinkled some zig in there. I've been meaning to mess with it for a while.
## Usage ## Usage
@ -20,30 +22,41 @@ Run these solutions like so:
deno run --unstable --allow-all $DAY.ts deno run --unstable --allow-all $DAY.ts
And the nim ones like so: And the Nim ones like so:
nim c -d:release -d:ssl --run $DAYMODULE.nim nim c -d:release -d:ssl --run $DAYMODULE.nim
And if you want to measure memory usage: And the Zig ones like so:
zig build-exe -O ReleaseFast 6.zig -femit-bin=build/zig-$DAY
./build/zig-$DAY
And if you want to measure memory usage with Deno programs:
mkdir -p build mkdir -p build
deno compile --output build/$DAY --unstable --allow-all $DAY.ts deno compile --output build/$DAY --unstable --allow-all $DAY.ts
/usr/bin/time -v ./build/$DAY /usr/bin/time -v ./build/$DAY
Or Or for Nim programs:
mkdir -p build mkdir -p build
nim c -d:release -d:ssl --outdir:build $DAYMODULE.nim nim c -d:release -d:ssl --outdir:build $DAYMODULE.nim
/usr/bin/time -v ./$DAYMODULE /usr/bin/time -v ./$DAYMODULE
Or for Zig programs:
mkdir -p build
zig build-exe -O ReleaseFast 6.zig -femit-bin=build/zig-$DAY
/usr/bin/time -v ./build/zig-$DAY
# Days # Days
- [x] [Day 1](./1.ts) - [x] Day 1: [Deno](./1.ts), [Nim](./one.nim)
- [x] [Day 2](./2.ts) - [x] Day 2: [Deno](./2.ts), [Nim](./two.nim)
- [x] [Day 3](./3.ts) - [x] Day 3: [Deno](./3.ts), [Nim](./three.nim)
- [x] [Day 4](./four.nim) - [x] Day 4: [Nim](./four.nim)
- [x] [Day 5](./five.nim) - [x] Day 5: [Nim](./five.nim)
- [x] [Day 6](./six.nim) - [x] Day 6: [Nim](./six.nim)
- [ ] Day 7 - [ ] Day 7
- [ ] Day 8 - [ ] Day 8
- [ ] Day 9 - [ ] Day 9