Hanukkah of Data 5783 in Rust

25 December 2022

Written as post six of #100DaysToOffload.

Hanukkah of Data is a cute little counterpart to Advent of Code that I thought I’d take a crack at this year. I like optimizing my solutions, so I set the goal of solving all the puzzles, front to back, in less than a second. And I’ve been on a real Rust kick lately, so that was my language of choice.

You can view my solutions on Sourcehut. Here I’ve provided some notes and hints. I hope these are helpful.


These are really just the questions the puzzles are asking, stated a bit more explicitly.

Puzzle 0

Find the password for the provided ZIP files.

You could do this by hand, but I decided to code it.

Puzzle 1

Find someone whose last name is their phoneword.

Puzzle 2

Find someone with initials JD who bought a bagel.

Puzzle 3

Find someone in the same neighborhood as JD who is an Aries born in the year of the dog.

Puzzle 4

Find someone who regularly buys pastries just before 5 AM.

This one took me an irritating hour and a half. Eventually I gave up and wrote a five-minute SQL query, then moved it over to Rust.

Puzzle 5

Find the person from Queens Village who buys the most cat products.

Most isn’t explicitly specified, and it took me a while to infer that it was meant. The sweatshirt is a red herring, since sweatshirts don’t appear anywhere in the product list.

The inferred most shows up a few more times.

Puzzle 6

Find the person who uses the most coupons.

Puzzle 7

Find the person who bought the same item, in a different color, as the couponer on the same day.

Puzzle 8

Find the person who buys the most store-branded merchandise.


I was pleased to see that with only a modicum of optimization on my part — mostly using hash joins instead of nested-loop joinseverything, including reading in the data, runs in less than a second:

liskova:~/projects/hanukkah-of-data-5783# cargo run --release
    Finished release [optimized] target(s) in 0.20s
     Running `target/release/hanukkah-of-data-5783`
Cracked zip in 12ms.
Loaded data in 430ms.
Solved puzzle 1 in 0ms.
Solved puzzle 2 in 7ms.
Solved puzzle 3 in 0ms.
Solved puzzle 4 in 28ms.
Solved puzzle 5 in 49ms.
Solved puzzle 6 in 26ms.
Solved puzzle 7 in 41ms.
Solved puzzle 8 in 32ms.
Total solve time: 185ms.