Code

The measuring harness

The test passes — your Put, grow, ChainStats and Keys are correct. Now you measure the index.

Two files in this step, both complete. They are not your task: the harness is scaffolding, not the exercise.

hashbench.go — algo index builds the index, prints its shape (buckets, load, chains) and then looks up every title — first through the index, then with lesson 1's linear search so the number has a scale.

algo ordered is step 9's question. It measures nothing; it shows what the index does not have.

And main.go — two lines, as always: two commands into usage and into the switch.

First run

Ten thousand items come in the next step. But make sure the command works:

$ algo gen -n 1000 -seed 42 -o s1k.jsonl
$ algo index -in s1k.jsonl

You should see the shape you are already learning to read: buckets, load, the longest chain, and at the bottom the comparisons per lookup. The same two numbers you have been counting by hand.