<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Anmol Maheshwari</title>
    <description>The latest articles on DEV Community by Anmol Maheshwari (@maheshwarianmol).</description>
    <link>https://dev.to/maheshwarianmol</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4067695%2F763563f8-d805-4bd7-ae23-543660ad96d0.png</url>
      <title>DEV Community: Anmol Maheshwari</title>
      <link>https://dev.to/maheshwarianmol</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/maheshwarianmol"/>
    <language>en</language>
    <item>
      <title>A Hash That Collided on Every Name and a 25 MB Allocator Trap: What 4 Tracks of Speed Demon 2026 Taught Us About OS, Cache Hierarchy, and AI</title>
      <dc:creator>Anmol Maheshwari</dc:creator>
      <pubDate>Mon, 09 Nov 2026 07:12:22 +0000</pubDate>
      <link>https://dev.to/maheshwarianmol/a-hash-that-collided-on-every-name-and-a-25-mb-allocator-trap-what-4-tracks-of-speed-demon-2026-1290</link>
      <guid>https://dev.to/maheshwarianmol/a-hash-that-collided-on-every-name-and-a-25-mb-allocator-trap-what-4-tracks-of-speed-demon-2026-1290</guid>
      <description>&lt;p&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt; For Speed Demon 2026 by Hackathon Raptors, our team (cONFIG) rewrote four deliberately slow Python reference implementations in zero-dependency Rust and C++23:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a 3.1M-line log aggregator (Track A, 32.05 s → 0.034 s, &lt;strong&gt;942×&lt;/strong&gt;)&lt;/li&gt;
&lt;li&gt;a 50,000-query boolean and phrase search engine over 256 MB of text (Track B, 56.35 s → 0.252 s, &lt;strong&gt;223×&lt;/strong&gt;)&lt;/li&gt;
&lt;li&gt;a 3.32M-row hostile CSV join (Track C, 14.44 s → 0.052 s, &lt;strong&gt;277×&lt;/strong&gt;)&lt;/li&gt;
&lt;li&gt;a 5M-edge shortest-path solver (Track D, 72.69 s → 0.456 s, &lt;strong&gt;159×&lt;/strong&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is the story of the mistakes that cost us the most time: a hash function that passed every SHA-256 gate while routing 100% of customer names into a single L1 slot, an &lt;code&gt;munmap&lt;/code&gt; call that made memory no smaller and wall time worse, Golden Cove L1/L2/L3 cache sizing across 12 hyperthreads, and why golfing line count with AI traps you in a local optimum until you do the hardware and scoring-function math yourself.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Repository:&lt;/strong&gt; &lt;a href="https://github.com/Yash-vs9/cOnfig-tracks" rel="noopener noreferrer"&gt;https://github.com/Yash-vs9/cOnfig-tracks&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Where All Four Tracks Ended Up
&lt;/h2&gt;

&lt;p&gt;We entered all four tracks with zero external dependencies (D = 1.00), targeting the Falkenstein scoring box (fsn1): Intel Core i5-13500, 6 Golden Cove P-cores / 12 threads pinned via &lt;code&gt;--cpuset-cpus="0-11"&lt;/code&gt;, turbo disabled at a fixed 2.50 GHz, 48 KiB L1d and 1.25 MiB L2 per P-core, 24 MiB shared L3.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Track&lt;/th&gt;
&lt;th&gt;Task &amp;amp; Dataset&lt;/th&gt;
&lt;th&gt;Language&lt;/th&gt;
&lt;th&gt;Reference (T_ref / M_ref)&lt;/th&gt;
&lt;th&gt;Our Best (T / M / S)&lt;/th&gt;
&lt;th&gt;Speedup&lt;/th&gt;
&lt;th&gt;Memory Reduction&lt;/th&gt;
&lt;th&gt;K / Speed Score&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Track A&lt;/td&gt;
&lt;td&gt;Ingest (3.1M logs, 239 MB)&lt;/td&gt;
&lt;td&gt;Rust (2024)&lt;/td&gt;
&lt;td&gt;32.05 s / 228 MB&lt;/td&gt;
&lt;td&gt;0.034 s / 35 MB / 334 lines (&lt;code&gt;282a0d6&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;942×&lt;/td&gt;
&lt;td&gt;6.5×&lt;/td&gt;
&lt;td&gt;34.19 (76.70)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Track B&lt;/td&gt;
&lt;td&gt;Index (256 MB corpus, 50k queries)&lt;/td&gt;
&lt;td&gt;Rust (2024)&lt;/td&gt;
&lt;td&gt;56.35 s / 2,199 MB&lt;/td&gt;
&lt;td&gt;0.252 s / 75 MB / 1782 lines (&lt;code&gt;282a0d6&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;223×&lt;/td&gt;
&lt;td&gt;29.3×&lt;/td&gt;
&lt;td&gt;18.84 (63.75)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Track C&lt;/td&gt;
&lt;td&gt;Join (3.32M hostile CSV rows, 204 MB)&lt;/td&gt;
&lt;td&gt;C++23&lt;/td&gt;
&lt;td&gt;14.44 s / 367 MB&lt;/td&gt;
&lt;td&gt;0.052 s / 15 MB / 332 lines (&lt;code&gt;1e59383&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;277×&lt;/td&gt;
&lt;td&gt;24.5×&lt;/td&gt;
&lt;td&gt;26.72 (71.34)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Track D&lt;/td&gt;
&lt;td&gt;Traverse (1.74M nodes, 5M edges, 2k queries)&lt;/td&gt;
&lt;td&gt;Rust (2024)&lt;/td&gt;
&lt;td&gt;72.69 s / 893 MB&lt;/td&gt;
&lt;td&gt;0.456 s / 83 MB / 704 lines (&lt;code&gt;282a0d6&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;159×&lt;/td&gt;
&lt;td&gt;10.8×&lt;/td&gt;
&lt;td&gt;13.34 (56.26)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The final numbers look clean in a table. Getting there was a sequence of wrong assumptions that the Falkenstein box corrected one by one.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. The Hash That Passed Every Gate and Missed the L1 Cache 99.98% of the Time (Track C)
&lt;/h2&gt;

&lt;p&gt;Track C asks you to join &lt;code&gt;records.csv&lt;/code&gt; (3.32M rows) against &lt;code&gt;regions.csv&lt;/code&gt; and emit per-region aggregates, including the exact count of distinct &lt;code&gt;customer_name&lt;/code&gt;s per region (&lt;code&gt;dn&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;To avoid cross-core atomic contention on every row, we put a thread-local 2-way L1 filter &lt;code&gt;tl_cache[2048][2]&lt;/code&gt; (32 KB per thread) in front of a lock-free global hash table (&lt;code&gt;name_keys[1 &amp;lt;&amp;lt; 18]&lt;/code&gt; + a 256-bit region bitset &lt;code&gt;name_bits[1 &amp;lt;&amp;lt; 18][4]&lt;/code&gt;). If &lt;code&gt;(name_hash, region_id)&lt;/code&gt; was already in the thread's &lt;code&gt;tl_cache&lt;/code&gt;, we skipped the global table entirely.&lt;/p&gt;

&lt;p&gt;Here is the exact &lt;code&gt;hash_bytes&lt;/code&gt; function we shipped in commit &lt;code&gt;1e59383&lt;/code&gt; (0.052 s, 15 MB, 71.344 pts):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="k"&gt;static&lt;/span&gt; &lt;span class="kr"&gt;inline&lt;/span&gt; &lt;span class="kt"&gt;uint64_t&lt;/span&gt; &lt;span class="nf"&gt;hash_bytes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="kt"&gt;char&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;uint32_t&lt;/span&gt; &lt;span class="n"&gt;len&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kt"&gt;uint64_t&lt;/span&gt; &lt;span class="n"&gt;h1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;len&lt;/span&gt; &lt;span class="o"&gt;^&lt;/span&gt; &lt;span class="mh"&gt;0x811c9dc5ULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;h2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;uint64_t&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="n"&gt;len&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mh"&gt;0x9e3779b97f4a7c15ULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;w&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;w1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;__builtin_expect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;len&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;8U&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;8U&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;memcpy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;memcpy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;w1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;len&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="n"&gt;h1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;_mm_crc32_u64&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;_mm_crc32_u64&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;h1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;w1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="n"&gt;h2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="n"&gt;h2&lt;/span&gt; &lt;span class="o"&gt;^&lt;/span&gt; &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mh"&gt;0x9e3779b97f4a7c15ULL&lt;/span&gt; &lt;span class="o"&gt;^&lt;/span&gt; &lt;span class="n"&gt;w1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mh"&gt;0x9e3779b97f4a7c15ULL&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="n"&gt;h1&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;32&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;^&lt;/span&gt; &lt;span class="n"&gt;h2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mh"&gt;0x100ULL&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="c1"&gt;// ...&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And inside the hot loop, we indexed the thread-local L1 filter using the low 11 bits of &lt;code&gt;nh&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="kt"&gt;uint32_t&lt;/span&gt; &lt;span class="n"&gt;tl_idx&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;uint32_t&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="n"&gt;nh&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt; &lt;span class="mi"&gt;2047&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It compiled cleanly. It passed every correctness check with an exact SHA-256 match. And when we shrunk the global table in commit &lt;code&gt;282a0d6&lt;/code&gt; (10 MB), our time actually regressed from 0.052 s to 0.066 s.&lt;/p&gt;

&lt;p&gt;Why? We finally dumped the raw hex output of &lt;code&gt;hash_bytes&lt;/code&gt; across customer names from the generator (&lt;code&gt;"Person_1001"&lt;/code&gt;, &lt;code&gt;"Person_1002"&lt;/code&gt;, &lt;code&gt;"Person_2500"&lt;/code&gt;, &lt;code&gt;"Person_9999"&lt;/code&gt;):&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Customer Name&lt;/th&gt;
&lt;th&gt;64-Bit Hash (&lt;code&gt;nh&lt;/code&gt;)&lt;/th&gt;
&lt;th&gt;Low 32 Bits (&lt;code&gt;(uint32_t)nh&lt;/code&gt;)&lt;/th&gt;
&lt;th&gt;&lt;code&gt;tl_idx = nh &amp;amp; 2047&lt;/code&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;"Person_1001"&lt;/td&gt;
&lt;td&gt;&lt;code&gt;0x369c194012cced30&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;0x12cced30&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;1328&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;"Person_1002"&lt;/td&gt;
&lt;td&gt;&lt;code&gt;0x10cceab412cced30&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;0x12cced30&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;1328&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;"Person_2500"&lt;/td&gt;
&lt;td&gt;&lt;code&gt;0xa08aee2a12cced30&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;0x12cced30&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;1328&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;"Person_5555"&lt;/td&gt;
&lt;td&gt;&lt;code&gt;0xfba9c18c12cced30&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;0x12cced30&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;1328&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;"Person_9999"&lt;/td&gt;
&lt;td&gt;&lt;code&gt;0xde6fb35212cced30&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;0x12cced30&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;1328&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Every 11-byte &lt;code&gt;"Person_XXXX"&lt;/code&gt; string had the exact same lower 32 bits (&lt;code&gt;0x12cced30&lt;/code&gt;) and hashed to &lt;code&gt;tl_idx = 1328&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Look at what happened in the registers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;For &lt;code&gt;"Person_1001"&lt;/code&gt; (&lt;code&gt;len = 11&lt;/code&gt;), &lt;code&gt;w&lt;/code&gt; (first 8 bytes) is &lt;code&gt;"Person_1"&lt;/code&gt; and &lt;code&gt;w1&lt;/code&gt; (last 8 bytes at &lt;code&gt;s + 3&lt;/code&gt;) is &lt;code&gt;"son_1001"&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;On little-endian x86-64, &lt;code&gt;"son_"&lt;/code&gt; (&lt;code&gt;0x5f6e6f73&lt;/code&gt;) occupies bits 0..31 of &lt;code&gt;w1&lt;/code&gt;, while the digits &lt;code&gt;"1001"&lt;/code&gt; occupy bits 32..63.&lt;/li&gt;
&lt;li&gt;Modular 64-bit multiplication (mod &lt;code&gt;2^64&lt;/code&gt;) shifts bits strictly upward. Bits 32..63 of &lt;code&gt;w1&lt;/code&gt; never flow downward into bits 0..31 of &lt;code&gt;h2&lt;/code&gt;!&lt;/li&gt;
&lt;li&gt;Meanwhile, &lt;code&gt;(h1 &amp;lt;&amp;lt; 32)&lt;/code&gt; put the hardware CRC32 entirely into the upper 32 bits.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Because the upper 32 bits (&lt;code&gt;h1&lt;/code&gt;) differed, the global hash table (&lt;code&gt;slot = (nh ^ (nh &amp;gt;&amp;gt; 32)) &amp;amp; HT_MASK&lt;/code&gt;) still produced the right answer, so every correctness test passed. But &lt;code&gt;tl_idx = (uint32_t)nh &amp;amp; 2047&lt;/code&gt; looked only at the bottom 11 bits, where &lt;code&gt;"Person_"&lt;/code&gt; and &lt;code&gt;"son_"&lt;/code&gt; were constant. Out of 2,048 slots in our L1 cache, 2,047 slots were permanently empty, and all 9,000+ names fought over the 2 ways of slot 1328, giving us a &lt;strong&gt;99.98% L1 cache miss rate&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Replacing the &lt;code&gt;h2&lt;/code&gt; multiply chain with a second &lt;code&gt;_mm_crc32_u64&lt;/code&gt; + a right-shift avalanche (&lt;code&gt;h ^ (h &amp;gt;&amp;gt; 29)&lt;/code&gt;) and an 8-miss software-pipelined &lt;code&gt;_mm_prefetch&lt;/code&gt; ring buffer (to hide the ~120-cycle L3 latency across 8 misses instead of probing 35 cycles after prefetching on the same row) cut our sandbox join time from &lt;strong&gt;74.1 ms to 50.9 ms&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. The Rewrite That Made Track A Slower: munmap vs. glibc ptmalloc2 Arenas
&lt;/h2&gt;

&lt;p&gt;We originally wrote Track A in C++ and switched to zero-dependency Rust after seeing Rust dominate the top of the Track A board. Our first Rust push (&lt;code&gt;1862874&lt;/code&gt;, &lt;code&gt;run-2f56a6016af5&lt;/code&gt;) ran in 0.0534 s with 42.0 MB of memory (69.88 pts). Adding an 8-byte SWAR latency parser and compacting lines for rustfmt (72.30 pts) and vectorizing the endpoint space scan with AVX2 (&lt;code&gt;61516e3&lt;/code&gt;, 75.06 pts) brought our time down to 0.038 s, but our memory stayed stubbornly stuck at 42 to 44 MB, while the leaders were at 18 to 20 MB.&lt;/p&gt;

&lt;p&gt;Our static &lt;code&gt;.bss&lt;/code&gt; struct (&lt;code&gt;SharedData&lt;/code&gt;) was only ~20.8 MB. Where was the extra 23 MB coming from?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Our wrong guess:&lt;/strong&gt; We assumed the kernel was charging part of the 239 MB &lt;code&gt;mmap&lt;/code&gt; of &lt;code&gt;/data/requests.log&lt;/code&gt; against our container's memory counter. So we added &lt;code&gt;hr_buf&lt;/code&gt; and &lt;code&gt;ep_buf&lt;/code&gt; to copy the interned hour and endpoint strings out of the file mapping and called &lt;code&gt;munmap(bp, sz)&lt;/code&gt; right after the scan phase finished.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What the box said:&lt;/strong&gt; Memory did not drop at all, and wall time got worse.&lt;/p&gt;

&lt;p&gt;The harness pre-warms &lt;code&gt;/data/requests.log&lt;/code&gt; into the host page cache with &lt;code&gt;vmtouch -t&lt;/code&gt; before the container starts. Under cgroups v2, mapping already-resident host page-cache pages with &lt;code&gt;PROT_READ&lt;/code&gt; + &lt;code&gt;MAP_SHARED&lt;/code&gt; charges 0 bytes of anonymous RSS to the container.&lt;/p&gt;

&lt;p&gt;Worse, cgroups v2 records &lt;code&gt;memory.peak&lt;/code&gt;, the lifetime high-water mark of the container. Calling &lt;code&gt;munmap&lt;/code&gt; after the scan phase cannot lower a peak that already happened; all it did was force Thread 0 to grab &lt;code&gt;down_write(&amp;amp;mm-&amp;gt;mmap_lock)&lt;/code&gt; in the kernel and tear down 61,184 page table entries while the clock was running.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The actual culprit (&lt;code&gt;/proc/self/smaps&lt;/code&gt;):&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When we inspected &lt;code&gt;/proc/self/smaps&lt;/code&gt; in our sandbox, two OS behaviors jumped out:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In Phase 2 (computing p50/p95/p99 per hour), we used a static buffer &lt;code&gt;l: [[u32; 49152]; 12]&lt;/code&gt; when an hour had &amp;lt;= 49,152 requests, with a fallback &lt;code&gt;v_lats.resize(tot, 0)&lt;/code&gt; (&lt;code&gt;Vec&amp;lt;u32&amp;gt;&lt;/code&gt;) if a peak hour exceeded 49,152. Whenever a peak hour crossed 49,152 requests across 12 threads, &lt;code&gt;Vec&lt;/code&gt; allocated and freed ~200 KB blocks concurrently. In glibc, freeing medium allocations across threads dynamically raises &lt;code&gt;M_MMAP_THRESHOLD&lt;/code&gt; and creates 12 retained per-thread ptmalloc2 heap arenas (~18 MB of dirty anonymous pages that glibc never returns to the OS).&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;std::thread::scope&lt;/code&gt; spawns threads with Linux's default 2 MB stack reservation.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Widening the static &lt;code&gt;.bss&lt;/code&gt; buffer to 75,000 per thread (deleting &lt;code&gt;Vec&lt;/code&gt; completely so &lt;code&gt;malloc&lt;/code&gt; is never called in the worker loop), locking glibc with &lt;code&gt;mallopt(M_ARENA_MAX, 1)&lt;/code&gt; and &lt;code&gt;mallopt(M_TRIM_THRESHOLD, 0)&lt;/code&gt;, and spawning threads via &lt;code&gt;Builder::new().stack_size(65536)&lt;/code&gt; in commit &lt;code&gt;282a0d6&lt;/code&gt; immediately dropped memory from 44 MB to 35 MB and brought wall time down to 0.034 s (76.695 pts).&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Track A Optimization Step&lt;/th&gt;
&lt;th&gt;Commit / Run ID&lt;/th&gt;
&lt;th&gt;Time (T)&lt;/th&gt;
&lt;th&gt;Memory (M)&lt;/th&gt;
&lt;th&gt;Lines (S)&lt;/th&gt;
&lt;th&gt;Score&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Initial Rust CSR + CRC32 interning&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;1862874&lt;/code&gt; (&lt;code&gt;run-2f56a6016af5&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;0.0534 s&lt;/td&gt;
&lt;td&gt;42 MB&lt;/td&gt;
&lt;td&gt;468&lt;/td&gt;
&lt;td&gt;69.88&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SWAR 8-byte latency parse + rustfmt compaction&lt;/td&gt;
&lt;td&gt;&lt;code&gt;run-0b81b4911a21&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;0.0520 s&lt;/td&gt;
&lt;td&gt;43 MB&lt;/td&gt;
&lt;td&gt;240&lt;/td&gt;
&lt;td&gt;72.30&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;AVX2 endpoint scanner + fixed hash bit-mixing&lt;/td&gt;
&lt;td&gt;&lt;code&gt;61516e3&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;0.0380 s&lt;/td&gt;
&lt;td&gt;44 MB&lt;/td&gt;
&lt;td&gt;282&lt;/td&gt;
&lt;td&gt;75.06&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Zero-Vec &lt;code&gt;.bss&lt;/code&gt; + mallopt + 64KB stacks + SWAR / &lt;code&gt;writev&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;&lt;code&gt;282a0d6&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;0.0340 s&lt;/td&gt;
&lt;td&gt;35 MB&lt;/td&gt;
&lt;td&gt;334&lt;/td&gt;
&lt;td&gt;76.70&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  3. CPU Microarchitecture &amp;amp; the Cache Hierarchy: Fitting Into Golden Cove L1/L2/L3
&lt;/h2&gt;

&lt;p&gt;Modern CPUs are starving for data, not compute. On the Falkenstein runner (Intel Core i5-13500, 6 Golden Cove P-cores / 12 hyperthreads pinned via &lt;code&gt;--cpuset-cpus="0-11"&lt;/code&gt;), an L1 data cache hit takes ~4 cycles, an L2 hit takes ~14 cycles, an L3 hit takes ~45–60 cycles, and a main-memory DRAM miss costs ~200+ cycles.&lt;/p&gt;

&lt;p&gt;Because two sibling hyperthreads (cpu 0 and cpu 1) share each physical P-core, they split that core's 48 KiB L1d cache (24 KiB effective per thread) and 1.25 MiB L2 cache (640 KiB effective per thread), while all 12 threads share the 24 MiB L3. Once we stopped treating memory as a flat array and started sizing every data structure against those exact cache boundaries, bottlenecks started making sense across all four tracks:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Domain Compression into L1/L2 (Track C):&lt;/strong&gt; Why build a &lt;code&gt;std::unordered_map&lt;/code&gt; when the key domain is tiny? In Track C, 3-letter uppercase country codes only have 26^3 = 17,576 possible combinations, so we mapped &lt;code&gt;c0..c2&lt;/code&gt; directly into &lt;code&gt;uint16_t c_to_dense[17577]&lt;/code&gt; (35.1 KiB, which fits inside L1/L2). Likewise, 6-digit &lt;code&gt;region_id&lt;/code&gt;s (0..999,999) fit in a flat &lt;code&gt;uint8_t reg_lut[1000000]&lt;/code&gt; (976 KiB, which fits entirely inside each P-core's 1.25 MiB L2). Every relational foreign-key lookup became a single L2-resident byte load (&lt;code&gt;reg_lut[reg]&lt;/code&gt;) with zero pointer chasing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;When Hyperthreads Evict Each Other's L1d (Track A &amp;amp; Track C):&lt;/strong&gt; In Track A, each thread had a 16 KiB direct-mapped stack cache &lt;code&gt;lc: [u64; 2048]&lt;/code&gt; (2048 × 8 B) to bypass global string interning. Two hyperthreads on the same P-core needed 32 KiB of &lt;code&gt;lc&lt;/code&gt; alone, leaving only 16 KiB of the 48 KiB L1d for stack frames, &lt;code&gt;requests.log&lt;/code&gt; streaming lines, and output chunks. Similarly, in Track C, a 32 KiB per-thread &lt;code&gt;tl_cache[2048][2]&lt;/code&gt; meant two sibling hyperthreads needed 64 KiB (16 KiB larger than L1d!), constantly evicting hot lines down to L2.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Eliminating MESI Cache-Line Bouncing (False Sharing):&lt;/strong&gt; When 12 threads increment adjacent counters in the same 64-byte cache line, the cores spend all their time invalidating each other's L1 caches over the ring bus. Sharding state into per-thread buffers (&lt;code&gt;T[12][256]&lt;/code&gt; in Track C, and 64-byte aligned &lt;code&gt;#[repr(C, align(64))]&lt;/code&gt; blocks in Track A) turned cross-core atomic wars into private L1 writes merged once at the end.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Track B (Search) &amp;amp; Track D (Graph Traversal): Designing Around the Queries You Can Already See
&lt;/h2&gt;

&lt;p&gt;While Track A and Track C were battles against SIMD byte parsing and cache-line contention, Track B and Track D taught us a different lesson: &lt;strong&gt;never build a general-purpose index when the query workload is sitting right there on disk.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Track B: Cutting 2,199 MB to 75 MB by Indexing Only What the 50,000 Queries Ask For
&lt;/h3&gt;

&lt;p&gt;Track B hands you a 256 MB text corpus and &lt;code&gt;queries.txt&lt;/code&gt;: 50,000 queries split between &lt;code&gt;BOOL&lt;/code&gt; (AND / OR / NOT, 62%) and &lt;code&gt;PHRASE "..."&lt;/code&gt; (exact adjacent token positions, 38%). The Python reference takes 56.35 s and explodes to 2,199 MB of RAM because storing occurrence positions for every token in a 256 MB corpus eats gigabytes of memory.&lt;/p&gt;

&lt;p&gt;Because build and query execution are timed together in a single run, and &lt;code&gt;queries.txt&lt;/code&gt; is readable from millisecond zero, building a full positional inverted index over the entire vocabulary is pure waste:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;By parsing &lt;code&gt;queries.txt&lt;/code&gt; first, we know the exact set of terms that ever appear in any boolean query, and the even smaller subset of terms that ever participate in a &lt;code&gt;PHRASE "..."&lt;/code&gt; query.&lt;/li&gt;
&lt;li&gt;Words that never appear in &lt;code&gt;queries.txt&lt;/code&gt; don't need postings lists at all, and words that only appear in &lt;code&gt;BOOL&lt;/code&gt; queries only need document IDs (or bitsets), never token positions.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Combining query-driven vocabulary filtering with parallel 12-thread corpus chunking and smallest-first posting-list intersection took Track B from 0.314 s (62.16 pts in &lt;code&gt;61516e3&lt;/code&gt;) down to &lt;strong&gt;0.252 s (223× faster than reference)&lt;/strong&gt; and &lt;strong&gt;75 MB (29.3× less memory)&lt;/strong&gt; in commit &lt;code&gt;282a0d6&lt;/code&gt; (63.751 pts).&lt;/p&gt;

&lt;h3&gt;
  
  
  Track D: 5 Million Directed Edges in 456 ms (&lt;code&gt;282a0d6&lt;/code&gt;)
&lt;/h3&gt;

&lt;p&gt;Track D gives you &lt;code&gt;graph.txt&lt;/code&gt; (92 MB: 1,740,512 nodes and 5,000,000 directed weighted edges &lt;code&gt;u v w&lt;/code&gt;, unsorted) and 2,000 source-target shortest-path queries (reference: 72.69 s, 893 MB).&lt;/p&gt;

&lt;p&gt;Here, heavy preprocessing (like full Contraction Hierarchies) doesn't have enough queries to pay back its build time, because the 2,000 queries are local with bounded search depth. Nearly the entire wall-clock battle is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Parallel edge-list ingestion (mmap + SWAR integer parsing):&lt;/strong&gt; Parsing 15 million integers (&lt;code&gt;u&lt;/code&gt;, &lt;code&gt;v&lt;/code&gt;, &lt;code&gt;w&lt;/code&gt; × 5M) across 12 threads without &lt;code&gt;strtol&lt;/code&gt; or &lt;code&gt;scanf&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Flat Compressed Sparse Row (CSR) memory layout:&lt;/strong&gt; Packing outgoing edges into a contiguous &lt;code&gt;(target, weight)&lt;/code&gt; array indexed by &lt;code&gt;head[u]&lt;/code&gt; so edge relaxations hit sequential cache lines instead of chasing pointers across an 893 MB heap.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Parallel query execution with generation-stamped distance arrays:&lt;/strong&gt; Running the 2,000 queries in parallel across all 12 threads using per-thread &lt;code&gt;(dist, version)&lt;/code&gt; tables so resetting Dijkstra between queries is a single &lt;code&gt;version += 1&lt;/code&gt; increment rather than a 7 MB &lt;code&gt;memset&lt;/code&gt; (1,740,512 × 4 B × 2,000 queries = 13.9 GB of zeroing avoided!).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That brought Track D to &lt;strong&gt;0.456 s (159× speedup)&lt;/strong&gt; and &lt;strong&gt;83 MB&lt;/strong&gt; (56.262 pts).&lt;/p&gt;

&lt;h2&gt;
  
  
  5. The 76.7 ms CSV Quote Scan Replaced by a 0.06 ms Automaton (Track C)
&lt;/h2&gt;

&lt;p&gt;One optimization on Track C deserves its own callout because it turned our slowest serial bottleneck into a 60-microsecond no-op.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;records.csv&lt;/code&gt; (204 MB, 3.32M rows) has ~404,713 newlines inside quoted &lt;code&gt;note&lt;/code&gt; fields. If you split the file at &lt;code&gt;t * sz / 12&lt;/code&gt; for 12 threads (&lt;code&gt;t = 1..11&lt;/code&gt;) and advance to the next &lt;code&gt;\n&lt;/code&gt;, you have a 50/50 chance of starting Thread &lt;code&gt;t&lt;/code&gt; in the middle of a multi-line note and corrupting the parse.&lt;/p&gt;

&lt;p&gt;Our first version ran &lt;code&gt;std::count&lt;/code&gt; across the 12 chunks to compute quote parity (odd vs even number of &lt;code&gt;"&lt;/code&gt; characters before &lt;code&gt;cs[t]&lt;/code&gt;). Scanning 204 MB just to count quotes took &lt;strong&gt;76.71 ms&lt;/strong&gt; in our local sandbox, more time than the entire 12-thread join!&lt;/p&gt;

&lt;p&gt;Then we looked at the grammar of &lt;code&gt;records.csv&lt;/code&gt;. An embedded newline inside &lt;code&gt;note&lt;/code&gt; is followed by free text, whereas a real record end is always preceded by &lt;code&gt;,region_id,[-]DDD.CC\r?\n&lt;/code&gt; and followed by &lt;code&gt;(\xEF\xBB\xBF)?[0-9]+,&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="k"&gt;static&lt;/span&gt; &lt;span class="kr"&gt;inline&lt;/span&gt; &lt;span class="kt"&gt;bool&lt;/span&gt; &lt;span class="nf"&gt;is_rec_end&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="kt"&gt;char&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;base&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;size_t&lt;/span&gt; &lt;span class="n"&gt;sz&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="kt"&gt;char&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;nl&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="kt"&gt;char&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;nl&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;nl&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;base&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;nl&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sc"&gt;'\r'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;base&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="sc"&gt;'.'&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="sc"&gt;'0'&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="sc"&gt;'9'&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="sc"&gt;'0'&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="sc"&gt;'9'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nb"&gt;false&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="o"&gt;-=&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;d_am&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;d_reg&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;d_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;base&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="sc"&gt;'0'&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="sc"&gt;'9'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="n"&gt;d_am&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;d_am&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nb"&gt;false&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;base&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sc"&gt;'-'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="n"&gt;base&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="sc"&gt;','&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nb"&gt;false&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;base&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="sc"&gt;'0'&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="sc"&gt;'9'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="n"&gt;d_reg&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;d_reg&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="n"&gt;base&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="sc"&gt;','&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nb"&gt;false&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="kt"&gt;char&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;nx&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;nl&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;nx&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="n"&gt;base&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;sz&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nb"&gt;true&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;nx&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="n"&gt;base&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;sz&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;uint8_t&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="n"&gt;nx&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mh"&gt;0xEF&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;uint8_t&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="n"&gt;nx&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mh"&gt;0xBB&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;uint8_t&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="n"&gt;nx&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mh"&gt;0xBF&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;nx&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;nx&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;base&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;sz&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;nx&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="sc"&gt;'0'&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;nx&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="sc"&gt;'9'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="n"&gt;nx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="n"&gt;d_id&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;d_id&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;nx&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;base&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;sz&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;nx&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sc"&gt;','&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Instead of scanning 204 MB from byte 0, each thread jumps directly to &lt;code&gt;t * sz / 12&lt;/code&gt; and tests &lt;code&gt;is_rec_end&lt;/code&gt; on the next 1–2 newlines. Chunk alignment dropped from &lt;strong&gt;76.71 ms to 0.061 ms (1,257× faster)&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Scoring-Function Engineering &amp;amp; Breaking Out of the AI Local-Optimum Loop
&lt;/h2&gt;

&lt;p&gt;We finished around the top 40 overall. Halfway through the event, when the organizers shared that the top 20 entries across each track collectively used 49 to 73 distinct optimization techniques, we realized why our scores on Track A (~76.7 pts) and Track C (~71.3 pts) had started inching up by only +0.3 points per push.&lt;/p&gt;

&lt;p&gt;We had fallen into a classic local-optimum loop, compounded by how we were prompting AI and how we were treating the objective function.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Math of the Objective Function (Why Golfing Lines Was a Trap)
&lt;/h3&gt;

&lt;p&gt;Look at the exponents in the composite factor K:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;K = (T_ref / T)^0.50  *  (M_ref / M)^0.25  *  (S_ref / S)^0.15  *  D^0.10
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Because wall time T carries a 0.50 exponent while S (post-rustfmt/clang-format &lt;code&gt;scc&lt;/code&gt; line count) carries only a 0.15 exponent:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Compressing code from 330 lines to 250 lines (-24% lines) multiplies K by (330 / 250)^0.15 = 1.0426 (+4.2%).&lt;/li&gt;
&lt;li&gt;Worse, &lt;code&gt;scc&lt;/code&gt; counts lines &lt;em&gt;after&lt;/em&gt; standard formatting (rustfmt / clang-format), so cramming multiple statements onto one line gets expanded right back out by the formatter while making the code harder to reason about.&lt;/li&gt;
&lt;li&gt;Meanwhile, spending +100 extra lines (330 → 430 lines, costing only -3.9% on the S factor) to implement a faster algorithm, like two-level radix bucketing on Track A, vocabulary-filtered bitset intersections on Track B, or bidirectional radix-heap search on Track D, that cuts T by 1.8× multiplies K by 1.8^0.50 × (330 / 430)^0.15 = 1.3416 × 0.961 = &lt;strong&gt;1.289 (+28.9%)&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;And build-time optimizations inside the Dockerfile, such as Profile-Guided Optimization (&lt;code&gt;-Cprofile-generate&lt;/code&gt; / &lt;code&gt;llvm-profdata&lt;/code&gt; / &lt;code&gt;-fprofile-use&lt;/code&gt;) and BOLT post-link binary layout optimization, deliver 8–15% wall-time reductions at zero &lt;code&gt;scc&lt;/code&gt; line cost.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Why AI Polishes Local Optima, and Why Systems Clarity Still Wins
&lt;/h3&gt;

&lt;p&gt;When you give an AI coding assistant a 300-line file and say "optimize this and keep the line count low", the AI will relentlessly polish the micro-syntax of the architecture you already have:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It will golf &lt;code&gt;if&lt;/code&gt; statements into &lt;code&gt;.then(|| ...)&lt;/code&gt; to save a few lines.&lt;/li&gt;
&lt;li&gt;It will tweak loop unrolling factors and register variables.&lt;/li&gt;
&lt;li&gt;And meanwhile, it will leave a 16 KiB direct-mapped stack array colliding on 1,842 Zipf endpoints, or leave 800,000 5xx log lines executing cross-core &lt;code&gt;lock xadd&lt;/code&gt; atomic instructions (&lt;code&gt;(*s).c[hid * 2048 + eid].fetch_add(1)&lt;/code&gt; instead of bit-packing &lt;code&gt;is_5xx&lt;/code&gt; into bit 11 of the thread-local request word).&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Four Lessons from Speed Demon 2026
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Language selection sets your ceiling and your floor:&lt;/strong&gt; Choosing zero-dependency Rust (D = 1.00) for Tracks A, B, and D and C++23 with OpenMP for Track C gave us fearless 12-thread parallelism and direct SIMD access, provided you tame runtime defaults like glibc arenas and 2 MB thread stacks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Design for the cache hierarchy first, instructions second:&lt;/strong&gt; Knowing the exact L1d (48 KiB), L2 (1.25 MiB), and L3 (24 MiB) budgets of the target CPU lets you compress key domains (like &lt;code&gt;c_to_dense[17577]&lt;/code&gt; and &lt;code&gt;reg_lut[1000000]&lt;/code&gt;) so lookups never touch DRAM.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Optimize for the real objective function, not code golf:&lt;/strong&gt; Never trade a 0.50-weight metric (wall-clock time) or a 0.25-weight metric (peak RSS) for a 0.15-weight metric (line count). When progress stalls at +0.3 points per push, stop micro-golfing and change the data structure.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AI writes the SIMD; your OS and hardware clarity chooses the architecture:&lt;/strong&gt; An LLM can emit &lt;code&gt;_mm256_movemask_epi8&lt;/code&gt; or a SWAR multiplier in seconds. What it cannot do on its own is tell you that 2 hyperthreads sharing a 48 KiB Golden Cove L1d cache are evicting each other's working sets, that glibc ptmalloc2 is retaining 12 heap arenas behind your back, or that little-endian 64-bit multiplication never shifts high-bit entropy into the low 32 bits.&lt;/li&gt;
&lt;/ol&gt;




&lt;p&gt;&lt;em&gt;Built by team cONFIG for Speed Demon 2026, the 72-hour performance engineering championship organized by Hackathon Raptors. All four track solutions (&lt;code&gt;track-a&lt;/code&gt;, &lt;code&gt;track-b&lt;/code&gt;, &lt;code&gt;track-c&lt;/code&gt;, &lt;code&gt;track-d&lt;/code&gt;) and optimization logs are in our repository: &lt;a href="https://github.com/Yash-vs9/cOnfig-tracks" rel="noopener noreferrer"&gt;https://github.com/Yash-vs9/cOnfig-tracks&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>rust</category>
      <category>cpp</category>
      <category>performance</category>
      <category>linux</category>
    </item>
    <item>
      <title>We Built a Hackathon Platform Where Every Rule Lives at the Layer That Can't Be Bypassed</title>
      <dc:creator>Anmol Maheshwari</dc:creator>
      <pubDate>Sun, 04 Oct 2026 13:08:26 +0000</pubDate>
      <link>https://dev.to/maheshwarianmol/we-built-a-hackathon-platform-where-every-rule-lives-at-the-layer-that-cant-be-bypassed-4546</link>
      <guid>https://dev.to/maheshwarianmol/we-built-a-hackathon-platform-where-every-rule-lives-at-the-layer-that-cant-be-bypassed-4546</guid>
      <description>&lt;p&gt;Hackathon Raptors gave every team at DOGFOOD 2026 the same brief and 72 hours: build the submission-and-judging platform they would actually run. The winner gets forked into production.&lt;/p&gt;

&lt;p&gt;We're a team of two. Our submission is &lt;strong&gt;Dogfood&lt;/strong&gt; — 9 Spring Boot microservices behind a gateway, a React frontend, PostgreSQL with Row-Level Security, RabbitMQ for the async event mesh, Redis, MinIO, and a judging engine built around z-score normalization with Bayesian shrinkage.&lt;/p&gt;

&lt;p&gt;This is the question we kept returning to while building it:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Where is this rule actually enforced?&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Not "does the UI hide the button." Not "does the frontend route guard redirect you." Where in the stack does the rule live, such that bypassing it is architecturally impossible?&lt;/p&gt;

&lt;p&gt;That question shaped every significant decision we made — including which tools we reached for and why.&lt;/p&gt;




&lt;h2&gt;
  
  
  Hiding a rule is not the same as enforcing it
&lt;/h2&gt;

&lt;p&gt;The hackathon spec says it plainly: role isolation must be enforced in the backend, and if it only works because the UI hides a button, it does not work.&lt;/p&gt;

&lt;p&gt;The naive version of "judges can't see each other's scores" is a frontend route guard plus a controller that trusts a &lt;code&gt;judge_id&lt;/code&gt; from the request body. Anyone with &lt;code&gt;curl&lt;/code&gt; and a valid token can swap the ID and get another judge's scores back.&lt;/p&gt;

&lt;p&gt;We enforce it twice, and the second layer is the one that matters:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Layer 1 — Application:&lt;/strong&gt; every score query filters by &lt;code&gt;judge_id&lt;/code&gt; taken from the verified JWT claim (&lt;code&gt;X-User-Id&lt;/code&gt; injected by the gateway), never from a request parameter.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Layer 2 — Database engine:&lt;/strong&gt; PostgreSQL Row-Level Security keyed on a session variable set from that same claim before every query:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SET&lt;/span&gt; &lt;span class="k"&gt;LOCAL&lt;/span&gt; &lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;current_user_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'&amp;lt;uuid-from-jwt&amp;gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="n"&gt;POLICY&lt;/span&gt; &lt;span class="n"&gt;judge_own_scores&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;judging&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;scores&lt;/span&gt;
  &lt;span class="k"&gt;USING&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;judge_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;current_setting&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'app.current_user_id'&lt;/span&gt;&lt;span class="p"&gt;)::&lt;/span&gt;&lt;span class="n"&gt;uuid&lt;/span&gt;
    &lt;span class="k"&gt;OR&lt;/span&gt; &lt;span class="n"&gt;current_setting&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'app.current_role'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;true&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;IN&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'ORGANIZER'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'ADMIN'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Even if the application code has a bug, the PostgreSQL kernel silently drops rows that don't belong to the requesting judge. The acceptance suite's T2 check — &lt;code&gt;judge cannot see peer scores&lt;/code&gt; — passes not because we wrote a special case for it, but because the rule lives at a layer that the request can't talk its way around.&lt;/p&gt;




&lt;h2&gt;
  
  
  The deadline is a domain constraint, not a UI feature
&lt;/h2&gt;

&lt;p&gt;A deadline shown in the frontend is a suggestion. A deadline checked against a client-sent timestamp is a suggestion with a race condition.&lt;/p&gt;

&lt;p&gt;The Submission Service enforces the cutoff on the server with a Redis distributed lock (&lt;code&gt;SETNX&lt;/code&gt;) and compares against the event's stored deadline using server time. The client's clock is never trusted. A submission attempted after the deadline is rejected regardless of client clock skew or network latency.&lt;/p&gt;

&lt;p&gt;The rule lives where authoritative time lives.&lt;/p&gt;




&lt;h2&gt;
  
  
  The math problem hiding inside score averaging
&lt;/h2&gt;

&lt;p&gt;Consider three judges scoring the same projects:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Judge A (Generous):&lt;/strong&gt; scores 8, 9, 10. Mean = 9, StdDev = 1.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Judge B (Harsh):&lt;/strong&gt; scores 2, 3, 4. Mean = 3, StdDev = 1.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Judge C (Neutral):&lt;/strong&gt; scores 4, 6, 8. Mean = 6, StdDev = 2.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Project X gets a 9 from Judge A, a 4 from Judge B, and an 8 from Judge C. Raw average: &lt;strong&gt;7.0&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;But look at what those scores actually mean relative to each judge's baseline:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Judge A's z-score for X: &lt;code&gt;(9 - 9) / 1 = 0&lt;/code&gt; — exactly average for them&lt;/li&gt;
&lt;li&gt;Judge B's z-score for X: &lt;code&gt;(4 - 3) / 1 = +1&lt;/code&gt; — above average for them&lt;/li&gt;
&lt;li&gt;Judge C's z-score for X: &lt;code&gt;(8 - 6) / 2 = +1&lt;/code&gt; — above average for them&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Normalized average: &lt;strong&gt;+0.67&lt;/strong&gt;. Judge A gave the highest raw score but contributed zero ranking signal — it was just their baseline. Judge B gave a low raw score but it was actually a positive signal relative to how they score everything.&lt;/p&gt;

&lt;p&gt;This is what per-judge, per-criterion z-score normalization does:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;z = (raw_score − judge_mean) / judge_std_dev&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It corrects both a judge's central tendency (hawk vs. dove) and their spread (a judge who clusters scores in a narrow band). Min-max scaling only fixes the range — z-score corrects central tendency too.&lt;/p&gt;




&lt;h2&gt;
  
  
  Bayesian shrinkage: what to do when a judge has only reviewed 2 projects
&lt;/h2&gt;

&lt;p&gt;Z-scores have a failure mode: a judge with 1 or 2 reviews gives you noisy estimates of their own mean and standard deviation. If that judge happens to draw a genuinely strong project, their normalized score can swing the leaderboard disproportionately.&lt;/p&gt;

&lt;p&gt;We apply Bayesian shrinkage with k₀ = 5 to handle this:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;λ = k / (k + 5)&lt;/p&gt;

&lt;p&gt;z_shrunk = λ × z + (1 − λ) × global_mean&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;Judge with &lt;strong&gt;1 review:&lt;/strong&gt; λ = 1/6 ≈ 0.167 — their score is &lt;strong&gt;dampened 83.3%&lt;/strong&gt; toward the global consensus mean.&lt;/li&gt;
&lt;li&gt;Judge with &lt;strong&gt;15 reviews:&lt;/strong&gt; λ = 15/20 = 0.75 — only 25% dampening, their calibration is trusted.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;One edge case handled explicitly: a judge who gives every project the same score has σ = 0, causing division by zero in the z-score formula. We set σ = 1.0 in that case, which maps all their scores to z = 0 and contributes zero ranking signal. This is a verified invariant in &lt;code&gt;NormalizationEngineTest.java&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The hawk/dove proof falls out cleanly: if Judge A (mean 8, σ 1) and Judge B (mean 4, σ 1) both score a standout project at +2σ above their own baseline (Judge A gives 10, Judge B gives 6), both produce z = +2.0. Their leniency difference becomes mathematically irrelevant.&lt;/p&gt;




&lt;h2&gt;
  
  
  Catching pre-built projects without shelling out
&lt;/h2&gt;

&lt;p&gt;One integrity problem most platforms we studied don't address: a team builds most of the project before the event, pushes to a private repo, then makes one commit during it. The submission looks legitimate.&lt;/p&gt;

&lt;p&gt;The Submission Service runs an &lt;strong&gt;in-memory Eclipse JGit scan&lt;/strong&gt; on every submitted repository URL and records a risk score:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;0 commits                           → risk 100  (EMPTY_REPOSITORY)
1 commit                            → risk 80   (SINGLE_COMMIT_DUMP)
&amp;gt;90% commits before event start     → HIGH      (PRE_HACKATHON_CODE)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two decisions worth explaining:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pure Java, no shell commands.&lt;/strong&gt; Running &lt;code&gt;git clone&lt;/code&gt; with a user-supplied URL is a command-injection surface. Eclipse JGit in a Java memory buffer removes it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A signal, not a verdict.&lt;/strong&gt; The scanner puts anomalies in an organizer review queue and never auto-disqualifies. A one-commit repo might be a legitimate solo build with poor git habits. Detection belongs to the machine; the decision belongs to a human.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why not a monolith? Why RabbitMQ? Why Redis?
&lt;/h2&gt;

&lt;p&gt;Fair questions for a 72-hour hackathon, where the simpler choice is usually the right one.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;On microservices vs. monolith:&lt;/strong&gt; the decision wasn't about scale. At fixture size — 40 projects, 30 judges — a well-structured monolith would have been fine. We split into services because the security boundaries are real and need to be structural, not just logical. The Submission Service must not be able to touch the &lt;code&gt;judging&lt;/code&gt; schema. The Judging Service must not be able to write to &lt;code&gt;submissions&lt;/code&gt;. When those concerns share a codebase and a connection pool, you're trusting developer discipline to maintain the boundary. When they're separate services with separate Flyway-managed schemas and no shared connection, the boundary is physical. You can't accidentally cross it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;On RabbitMQ:&lt;/strong&gt; score submission is a write path that needs to stay fast, especially in the final hour of an event when judges are racing the deadline. If submitting a score also triggered synchronous re-normalization across all scores for the event, that write would slow down as the event grew. Instead, the score commits to PostgreSQL and publishes a &lt;code&gt;score.submitted&lt;/code&gt; event to the &lt;code&gt;dogfood.events&lt;/code&gt; topic exchange in under 50ms. Normalization recompute, audit log write, webhook dispatch, and notification all happen asynchronously on their own queues — &lt;code&gt;audit.queue&lt;/code&gt;, &lt;code&gt;certificate.queue&lt;/code&gt;, &lt;code&gt;webhook.queue&lt;/code&gt;, &lt;code&gt;notification.queue&lt;/code&gt;. The judge gets a fast response regardless of what follows.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;On Redis:&lt;/strong&gt; two separate jobs. The Voting Service rate-limiter uses a Redis token-bucket per IP/account — Redis's atomic increment operations make this correct under concurrency in a way a database counter isn't, without the lock overhead. The submission deadline lock uses &lt;code&gt;SETNX&lt;/code&gt; because it needs to be atomic and shared across any instance of the Submission Service. Both are cases where Redis does something PostgreSQL can technically do, but with better latency and simpler concurrency guarantees for their specific access patterns.&lt;/p&gt;




&lt;h2&gt;
  
  
  What the architecture diagram doesn't show
&lt;/h2&gt;

&lt;p&gt;Our README has an ASCII diagram of all 9 services. What it doesn't show is that the diagram is the &lt;em&gt;output&lt;/em&gt; of one question asked repeatedly: where does this rule live, and can someone get around that layer from outside?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Deadline enforcement → Redis lock on the server, not a client timestamp&lt;/li&gt;
&lt;li&gt;Score isolation → PostgreSQL RLS at the kernel, not a route guard&lt;/li&gt;
&lt;li&gt;Score fairness → Bayesian normalization in the judging engine, not a post-event spreadsheet&lt;/li&gt;
&lt;li&gt;Commit integrity → in-memory JGit at submission, not an organizer eyeballing GitHub profiles&lt;/li&gt;
&lt;li&gt;Webhook trust → HMAC-SHA256 signed payloads, not plain HTTP callbacks&lt;/li&gt;
&lt;li&gt;Concurrency safety → RabbitMQ decoupling, not synchronous blocking writes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The microservices weren't the goal. They fell out of keeping each rule in the layer that owns it.&lt;/p&gt;




&lt;h2&gt;
  
  
  The moment the architecture pushed back
&lt;/h2&gt;

&lt;p&gt;One thing no diagram captures: &lt;code&gt;docker compose up&lt;/code&gt; ran out of resources on a local machine.&lt;/p&gt;

&lt;p&gt;By the time all containers were up, the stack was consuming &lt;strong&gt;3.13GB of RAM&lt;/strong&gt; on a 7.4GB host and peaking at &lt;strong&gt;1376% CPU&lt;/strong&gt; across 12 cores — all before a single HTTP request had landed. Nine Spring Boot services each with their own JVM heap, plus PostgreSQL, RabbitMQ, Redis, and MinIO, adds up fast.&lt;/p&gt;

&lt;p&gt;We moved to a cloud shell instance, which was only possible because my teammate had a student subscription. Without it, we would have been cutting services under time pressure.&lt;/p&gt;

&lt;p&gt;That's an honest cost of the microservices decision, and we'd rather say it than hide it. The fix — capping each service's JVM heap with &lt;code&gt;-Xmx&lt;/code&gt; in the Compose file — is straightforward. Most of these services don't need 512MB each at hackathon scale. But we ran out of time before we could tune it, and the spec asks for something that runs on a laptop. Ours runs, but comfortably only on a machine with enough headroom, and that's worth saying plainly.&lt;/p&gt;




&lt;h2&gt;
  
  
  What we claimed and what we proved
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;.dogfood.toml&lt;/code&gt; claims T1 and T2. The acceptance suite verifies exactly that — 7 of 7 checks passing:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tap"&gt;&lt;code&gt;T1  gallery is public ................. PASS
T1  project from fixtures shown ....... PASS
T1  closed event refuses submissions .. PASS
T2  judge sees own scores ............. PASS
T2  judge cannot see peer scores ...... PASS
T2  participant blocked ............... PASS
T2  csv export works .................. PASS

claimed T1 T2, verified T1 T2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Quadratic voting, Ed25519-signed certificates, the OpenAPI spec, and bulk export are implemented, but the acceptance suite doesn't cover them, so we don't claim them in &lt;code&gt;.dogfood.toml&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;A judging platform that is vague about what it can prove is hard to trust. We tried to be exact about our own limits.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Repo:&lt;/strong&gt; &lt;a href="https://github.com/codewisp-ai/DogFood" rel="noopener noreferrer"&gt;github.com/codewisp-ai/DogFood&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;Stack:&lt;/strong&gt; Java 21 · Spring Boot 3.3 · PostgreSQL 16 · RabbitMQ 3.13 · Redis 7 · MinIO · React&lt;br&gt;
&lt;strong&gt;License:&lt;/strong&gt; MIT · &lt;code&gt;docker compose up -d&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Built for DOGFOOD 2026 by Hackathon Raptors. #Dogfood2026&lt;/em&gt;&lt;/p&gt;

</description>
      <category>hackathon</category>
      <category>opensource</category>
      <category>java</category>
      <category>distributedsystems</category>
    </item>
    <item>
      <title>My "reproducible" build kept returning the same hash after the code changed. That was the bug.</title>
      <dc:creator>Anmol Maheshwari</dc:creator>
      <pubDate>Sat, 05 Sep 2026 15:01:12 +0000</pubDate>
      <link>https://dev.to/maheshwarianmol/my-reproducible-build-kept-returning-the-same-hash-after-the-code-changed-that-was-the-bug-4npj</link>
      <guid>https://dev.to/maheshwarianmol/my-reproducible-build-kept-returning-the-same-hash-after-the-code-changed-that-was-the-bug-4npj</guid>
      <description>&lt;p&gt;TL;DR: I built ZeroTrust — a supply-chain security scanner, zero third-party dependencies, go.mod with no require block — for the Zero Dependency Hackathon (Track E). It catches phantom packages, typosquats, lifecycle-hook backdoors, obfuscated payloads, and eval()-style dynamic execution. The scanner passed every test I wrote for it. Three times, my own verification process tried to hand me a result that looked correct and wasn't. This is what a tool built to catch deception looks like when it nearly deceives its own author.&lt;/p&gt;

&lt;p&gt;The dependency that couldn't be the point&lt;/p&gt;

&lt;p&gt;You already know why this hackathon exists if you've read the brief: chalk and debug, 2.6 billion combined weekly downloads, one phished maintainer account, a crypto-clipper hiding in memory. Shai-Hulud republishing itself into hundreds of packages days later. xz, two years of patient trust-building, one code review away from a backdoor on every Linux server on earth. And now the newer, quieter version of the same problem: AI coding assistants hallucinate package names 19.7% of the time, and attackers have started pre-registering the names the models reliably invent — a supply-chain attack where the victim never even makes a typo, because the machine makes it for them.&lt;/p&gt;

&lt;p&gt;So I built the tool that's supposed to catch exactly that — and I built it with an empty manifest, because a security scanner that asks you to trust more strangers to protect you from strangers has already lost its own argument.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="gp"&gt;$&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;cat &lt;/span&gt;go.mod
&lt;span class="go"&gt;module zerotrust
go 1.22

&lt;/span&gt;&lt;span class="gp"&gt;$&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;go list &lt;span class="nt"&gt;-m&lt;/span&gt; all
&lt;span class="go"&gt;zerotrust
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's the entire dependency tree. Everything else — a Bloom filter, a prefix Trie, a TOML tokenizer, a rate limiter, ANSI terminal styling, a SARIF 2.1.0 emitter — is hand-rolled against Go's standard library. Eleven substitutions, each with its own entry in STDLIB.md, because a claim like "zero dependencies" is worthless if it isn't also checkable in under five seconds.&lt;/p&gt;

&lt;p&gt;That instinct — don't just claim something, make it checkable — is what turned this into a much more interesting three days than "write five detectors and call it done."&lt;/p&gt;

&lt;p&gt;Five detectors, one honest question underneath all of them&lt;/p&gt;

&lt;p&gt;ZeroTrust runs five checks, offline by default: phantom-package detection (Bloom filter + Trie against a curated, provenance-documented corpus), typosquat detection (hand-rolled Levenshtein distance), lifecycle-hook scanning (the exact mechanism Shai-Hulud used), Shannon-entropy scanning for obfuscated payloads, and lexical detection of dynamic-execution calls (eval, child_process.exec, os.system).&lt;/p&gt;

&lt;p&gt;Every one of those detectors exists to answer one question: is this thing actually what it claims to be?&lt;/p&gt;

&lt;p&gt;Which made it uncomfortable, in a useful way, when my own build pipeline started asking me the same question back.&lt;/p&gt;

&lt;p&gt;Bug 1: the reproducible build that lied by staying the same&lt;/p&gt;

&lt;p&gt;make verify-reproducible builds the binary twice and diffs the hashes. Simple, and it passed — the same hash, every single time I ran it, across multiple sessions:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;A6DB0B58130997745CFF9798B0FDCF6BBD28DE03910F1F0E34BDB0AB6472E985&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;That should have felt like success. It felt wrong instead, for a reason that took me a while to name: real code had changed in between those checks. JSON output landed. SARIF emission landed. Severity-aware exit codes landed. A reproducible build is supposed to mean identical source → identical bytes — it is emphatically not supposed to mean the hash never moves no matter what I do to the source. One of those is determinism. The other is a build that isn't actually rebuilding what I think it's rebuilding, or is embedding something that has nothing to do with my code.&lt;/p&gt;

&lt;p&gt;It was the second one. Since Go 1.18, go build stamps the current git commit hash and a timestamp into the binary by default — vcs.revision, vcs.time — unless you explicitly pass -buildvcs=false. My "stable" hash wasn't proof of a clean build. It was a coincidence of which git commit happened to be checked out at each of my testing sessions.&lt;/p&gt;

&lt;p&gt;The proof that this was really it: I made a doc-only commit — zero code changes, just Markdown — and rebuilt.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;14D9E8B23FF9786D54F7F82764CCC8B587F9E59E97743026DFBD74226FC6714D&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Different hash. From a commit that changed nothing but a README. If a Markdown edit can move your "reproducible" hash, the hash was never measuring what the bonus claim says it measures.&lt;/p&gt;

&lt;p&gt;Fixed with one flag, everywhere the binary gets built:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight make"&gt;&lt;code&gt;&lt;span class="err"&gt;makefile&lt;/span&gt;
&lt;span class="err"&gt;go&lt;/span&gt; &lt;span class="err"&gt;build&lt;/span&gt; &lt;span class="err"&gt;-trimpath&lt;/span&gt; &lt;span class="nv"&gt;-buildvcs&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;false&lt;/span&gt; &lt;span class="nt"&gt;-ldflags&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"-buildid= -s -w"&lt;/span&gt; &lt;span class="nt"&gt;-o&lt;/span&gt; ./bin/zerotrust .

&lt;span class="nl"&gt;And a final, actually-trustworthy pair&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;

&lt;span class="nl"&gt;Build 1 SHA256 (windows)&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;D112B856931D9473E5DF7EC6175E4412FA8D0CE8F76FAF5AE7E6C0438ACB1E9E&lt;/span&gt;
&lt;span class="nl"&gt;Build 2 SHA256 (windows)&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;D112B856931D9473E5DF7EC6175E4412FA8D0CE8F76FAF5AE7E6C0438ACB1E9E&lt;/span&gt;
&lt;span class="nl"&gt;REPRODUCIBLE BUILD VERIFICATION&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;PASS&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Still identical. But now I'd earned the right to say so, because I'd also watched it correctly fail to be identical when it should have — the doc-only-commit test is what turned "the hash matches" from a hope into an actual falsifiable check. A reproducible-build claim you haven't watched break is a build you haven't actually verified — you've just watched a coincidence hold twice.&lt;/p&gt;

&lt;p&gt;Bug 2: the safety claim I couldn't check on my own machine&lt;/p&gt;

&lt;p&gt;go test -race ./... is how I back up "no data races in the concurrent worker pool." On my own Windows dev machine, it didn't run at all:&lt;/p&gt;

&lt;p&gt;cc1.exe: sorry, unimplemented: 64-bit mode not compiled in&lt;/p&gt;

&lt;p&gt;The race detector needs CGO, CGO needs a working 64-bit C compiler, and my local MinGW toolchain was 32-bit-only. For a real stretch of this build, "the race detector passes" was a claim I genuinely could not verify on the machine I was developing on. Not a cosmetic annoyance — a security tool's own concurrency-safety claim, unverifiable, on the platform I was actually shipping from.&lt;/p&gt;

&lt;p&gt;I didn't fix the toolchain. I changed which environment got to answer the question:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;bash
docker run &lt;span class="nt"&gt;--rm&lt;/span&gt; &lt;span class="nt"&gt;-v&lt;/span&gt; &lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;PWD&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;:/app &lt;span class="nt"&gt;-w&lt;/span&gt; /app golang:1.22 go &lt;span class="nb"&gt;test&lt;/span&gt; ./... &lt;span class="nt"&gt;-v&lt;/span&gt; &lt;span class="nt"&gt;-race&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Clean pass, real Linux, real ELF binary, real 64-bit cc. Then a third, fully independent confirmation once the repo was pushed — GitHub Actions' own ubuntu-latest runners, green on every push since:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ok      zerotrust/tests 5.756s
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Same source, three separate environments, one of which genuinely couldn't tell me the answer at all. The lesson isn't "Windows is bad" — it's that a claim your own dev machine can't check is a claim you don't actually have yet, no matter how confident the surrounding code looks.&lt;/p&gt;

&lt;p&gt;Bug 3: the validator output that was lying about what it validated&lt;/p&gt;

&lt;p&gt;I claimed a real SARIF 2.1.0 subset, so I ran Microsoft's own sarif-multitool validate against it — the point being that "the JSON parses" and "a schema validator accepts this as real SARIF" are different claims, and only one of them is worth putting in a README.&lt;/p&gt;

&lt;p&gt;The first attempt produced output I couldn't actually trust, and the reason was almost funny: the pasted validator output had ZeroTrust's own startup banner mixed into it — a stray line from the tool being validated, sitting inside what was supposed to be the validator's independent verdict. Contaminated evidence. I genuinely couldn't tell from that run whether sarif-multitool had validated anything or whether I was reading noise.&lt;/p&gt;

&lt;p&gt;I caught it because the contaminating line was visibly out of place — it didn't belong to the tool that was supposed to be running. That's the same instinct the entropy scanner runs on every payload it looks at: something in this stream doesn't match what it claims to be.&lt;/p&gt;

&lt;p&gt;Redo, deliberately isolated — generate the file to disk first, run the validator as a fully separate step, nothing interleaved:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;bash
./bin/zerotrust &lt;span class="nt"&gt;--path&lt;/span&gt; &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;--format&lt;/span&gt; sarif &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; results.sarif
sarif-multitool validate results.sarif
&lt;span class="c"&gt;# exit code: 0&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Clean. Trustworthy, this time, because I'd removed the thing that made the first result unreadable rather than just re-running it and hoping for a cleaner-looking paste.&lt;/p&gt;

&lt;p&gt;What I'm not going to pretend happened&lt;/p&gt;

&lt;p&gt;Three real bugs is a true story. Five would be padding, and this hackathon specifically rewards naming your limits rather than hiding them — so here's what didn't have drama, stated plainly instead of dressed up:&lt;/p&gt;

&lt;p&gt;The entropy threshold (7.2 bits/byte) was correct on every run I checked. No tuning story, no wrong version I quietly fixed. If there's an origin story for that exact number, I don't have one to tell you.&lt;br&gt;
The tokenizer's blind spot (globalThis&lt;a href=""&gt;'ev'+'al'&lt;/a&gt; defeating lexical pattern matching) is a real, honestly-documented limitation — but I reasoned my way to it, I didn't watch it fail in front of me. Different kind of claim, and I'd rather say so than imply I caught it live.&lt;br&gt;
The Bloom filter's false-positive rate measured 0.0449 against a &amp;lt;0.05 target on the very first check and every check after. No wrong m/k calculation I had to walk back.&lt;br&gt;
Skipping the Single File bonus was a clean, upfront decision — the project's actual shape (four manifest parsers, two hand-rolled data structures, five detectors, a rate limiter, three output renderers) was never going to collapse into one file without sacrificing the test isolation and idiomatic package boundaries a senior Go reviewer would expect. I didn't start down that path and bail. I never started down it.&lt;/p&gt;

&lt;p&gt;A write-up where every single corner has a dragon in it stops being credible around the third dragon. Some corners were just fine. Saying so is worth more than inventing tension that wasn't there.&lt;/p&gt;

&lt;p&gt;By the numbers&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="gp"&gt;$&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;go &lt;span class="nb"&gt;test&lt;/span&gt; ./... &lt;span class="nt"&gt;-v&lt;/span&gt; &lt;span class="nt"&gt;-race&lt;/span&gt;
&lt;span class="c"&gt;...
&lt;/span&gt;&lt;span class="go"&gt;--- PASS: TestBloomFilterFalsePositiveBound (0.03s)
    bloom_test.go:52: Actual false positive rate: 0.0449 (target: 0.0500)
&lt;/span&gt;&lt;span class="c"&gt;...
&lt;/span&gt;&lt;span class="go"&gt;PASS
ok      zerotrust/tests 5.756s
0 third-party runtime dependencies (go list -m all prints one line: zerotrust)
2,489 lines across 28 Go files

&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;15/15 tests passing, race-detector clean, verified independently across Windows-hosted Docker Linux and GitHub Actions' ubuntu-latest&lt;br&gt;
11 documented stdlib-for-package substitutions in STDLIB.md, each on the runtime path — none decorative&lt;br&gt;
6 real attack-pattern findings caught in under a second against a seeded malicious fixture — phantom packages, typosquats, and a curl | sh postinstall hook&lt;br&gt;
1 reproducible-build hash that was wrong for reasons that had nothing to do with the algorithm I thought I was testing&lt;br&gt;
The thing worth taking from this&lt;/p&gt;

&lt;p&gt;A scanner built to catch things pretending to be something they aren't spent its own build process doing exactly that to me, three separate times: a hash that looked stable because it wasn't actually being regenerated against new source, a safety guarantee my own machine was incapable of confirming, and a validation result contaminated by output that didn't belong to the tool producing it.&lt;/p&gt;

&lt;p&gt;None of those were subtle attacks. They were the ordinary, boring failure mode of trusting the first result that looks clean. The entire pitch of this hackathon is that removing dependencies doesn't remove the need for engineering judgment — it just means every piece of that judgment is visibly yours, including the parts where you almost believed something that wasn't true.&lt;/p&gt;

&lt;p&gt;The tool's job is to stop trusting things by default. Turns out that had to start with not trusting my own green checkmarks either.&lt;br&gt;
&lt;a href="https://github.com/codewisp-ai/ZeroTrust.git" rel="noopener noreferrer"&gt;GITHUB REPO&lt;/a&gt;&lt;br&gt;
Built solo for the Zero Dependency Hackathon 2026, Track E (Security &amp;amp; Crypto Utilities). Repo, STDLIB.md, and deps-proof.txt are all public — the reproducible-build command is in the README if you want to try breaking it the way I did.&lt;/p&gt;

&lt;h1&gt;
  
  
  ZeroDependencyHack #Go #Security #SupplyChain #Testing #BuildInPublic
&lt;/h1&gt;

</description>
      <category>go</category>
      <category>security</category>
      <category>showdev</category>
      <category>testing</category>
    </item>
  </channel>
</rss>
