Speed Demon 2026: break it to find it, and let the scoring box decide — Engineering Notes article by Rui Codex

Rui Codex entered all four tracks of Hackathon Raptors' Speed Demon 2026 in Rust, standard library only. Code and per-track logs with board run IDs: https://github.com/ruicodex-dev/speed-demon-2026 (MIT).

The one lesson. Our largest step after the first Rust port came from deliberately breaking the program. On Track C (a CSV join) we removed name interning, which makes the output wrong, just to time it: user CPU fell from 2.1 s to 0.55 s. Three quarters of the work was name lookups in twelve per-thread tables. Records now append to per-partition buffers, and each partition owner interns a table that stays in cache. K rose 1.41x (9.40 -> 13.30): 0.165 -> 0.109 s, 139 -> 69 MB. One wrong-on-purpose run showed the ceiling before we built anything.

Setup. The scoring box is a Core i5-13500 pinned to six P-cores (12 threads), turbo off at 2.5 GHz, 8 GB, 1.25 MB of L2 per core. Our laptop (i9-13900H, WSL2, turbo on, 2 MB L2) was shared with other work, so it only ever compared two binaries; the live board decided. K = (T_ref/T)^0.5 x (M_ref/M)^0.2 x (S_ref/S)^0.15 x (D_ref/D)^0.15; points = 50 x log10(K).

The journey (selected steps; every row is a board run in the track's PERF.md).

Track Hypothesis Before After Kept?
A logs One per-line array, records rewritten in place 0.088 s, 74.3 MB 0.072 s, 42.5 MB yes
A ~25 % of time in libc memcpy/memcmp: masked 8-byte loads 0.0613 s 0.0555 s yes
B search Phrases matched by Aho-Corasick during the scan 1.63 s 1.14 s yes
B Frequent terms stored as bitmaps 0.78 s, 300 MB 0.61 s, 187 MB yes
C join Sequential appends + cache-sized tables 0.165 s, 139 MB 0.109 s, 69 MB yes
C Slot index as name id (laptop: 1.13x faster) 0.1016 s, 39.9 MB 0.1081 s, 44.7 MB no
D paths Targets with no in-edge answered without a search 1.43 s 0.96 s yes
D Nodes renumbered in BFS order 0.96 s 0.58 s yes
D One u32 per edge, rare heavy weights in a map 118.0 MB 81.1 MB yes

What did not work.

A laptop win the board refused. C's slot-as-id change removed one of three cache misses per lookup and was 1.13x faster locally. On the board it was slower and bigger: the bitsets grew 2.6x, and the scoring CPU has 1.25 MB of L2 against our 2 MB. Reverted the next commit.

Fewer nodes, worse score. Bidirectional Dijkstra on D settles 42 % fewer nodes. The first version was 2.3x slower; perf found three causes in turn (arrays filled instead of calloc'd, u32 overflow on the spec's near-2^32 edges, one side sweeping the whole graph). Fixed, it was 1.14x faster, but peak memory went 146 -> 258 MiB: 1.14^0.5 x (146/258)^0.2 = 0.95. Kept out.

A measurement we misread. Chunk-local bitmaps on B, replacing ~25M atomic fetch_or calls, showed no gain in a wall-clock A/B (1.105 +/- 0.264 s against 1.021 +/- 0.186 s). perf later put that lock or at 8.6 %. Interleaving the two binaries run by run and comparing median CPU: 18.2 -> 16.7 s. Sequential A/Bs of one pair had read 0.83 vs 1.16 s, then 1.69 vs 1.14 s, so every later A/B was interleaved.

One call, opposite effects. The board read about 25 MB more than our laptop on C. Smaller thread stacks and a single malloc arena changed nothing; setting transparent huge pages to always locally reproduced it. prctl(PR_SET_THP_DISABLE) took C from 41.0 to 16.8 MB without costing time, but made B (0.48 -> 0.52 s) and D (0.30 -> 0.34 s) slower. Only C keeps it.

Tune for 12 threads, not yours. At the board's 12 threads a D build bucket was ~63.5 KB, just under glibc's 64 KB mmap threshold, so freeing it returned nothing (75 KB at the laptop's 10 threads). A threshold derived from the bucket size took board memory from 79-81 to 75 MB.

Correctness. The gate is byte-for-byte output, five runs out of five. Every pushed change was also checked on seeds 2 and 3, seed 2 at full size, and tiny seeds for A and C. Shortcuts carry exact fallbacks: D's u32 distances repeat in u64 on overflow; C's name table restarts four times larger if it fills; B's frequency sample picks a representation, never an answer. C's chunking relies on a spec guarantee (CR only in CRLF terminators), not on the public file. The final commit passed every gate on all four tracks.

K, not just time. Growing the source by f pays only if the speed-up beats f^0.3: +50 % lines needs 1.13x. No track has a dependency (D = 1). Memory was often the cheapest win: A maps its input instead of copying it, and frees its records before writing its 10 MB output, whose page cache is charged to the run.

Results. Reference -> final commit: A 32.05 s -> 0.0552 s, B 56.35 -> 0.490 s, C 14.44 -> 0.0750 s, D 72.69 -> 0.235 s; memory 228 -> 25.5, 2,200 -> 122.4, 367.4 -> 12.4 and 892.9 -> 76.1 MB. On the frozen public board we were mid-table: A 71st of 134, B 66th of 104, C 75th of 111, D 40th of 113. Final scores (holdout seed plus judges) come on 13 November. Noise is real: the same A code ran 0.0490 s and, as our final commit, 0.0552 s.

With 24 more hours. D: the query loop is 69 % of CPU, mostly misses on neighbour distances (16 %) and offsets (~8 %); it needs a search order that does not double memory. B, our weakest track: profile-guided optimisation was allowed and is not in our log. A: the final 10 MB write is serial (9-18 ms locally).

How it was built. With Claude Code, Anthropic's coding agent: it wrote the Rust, ran perf and the interleaved A/Bs, and drafted this post. Every change was checked against the expected output hashes, measured before it was kept, and reviewed by Rui Codex; the reverted ones are in the logs too.

Sources cited in this article

  1. https://github.com/ruicodex-dev/speed-demon-2026 (github.com)
Tags: Rust Performance Engineering Hackathon

Need Help Implementing This?

Our team can help you put these insights into practice. From AI automation to custom software development, we build solutions that deliver real results.

Send a project request