Your browser sucks, JavaScript disabled! Gunnar's console needs JavaScript and WebAssembly. Git over SSH on port 2222 does not.

nordisk/znippy

.nornir/assets/zoomies_split.svg

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1180 700" font-family="'DejaVu Sans', 'Segoe UI', sans-serif">
  <defs>
    <linearGradient id="board" x1="0" y1="0" x2="0" y2="1">
      <stop offset="0" stop-color="#0b1c2e"/>
      <stop offset="1" stop-color="#06111d"/>
    </linearGradient>
    <linearGradient id="chip" x1="0" y1="0" x2="0" y2="1">
      <stop offset="0" stop-color="#14384f"/>
      <stop offset="1" stop-color="#0e2a3e"/>
    </linearGradient>
    <linearGradient id="rail" x1="0" y1="0" x2="0" y2="1">
      <stop offset="0" stop-color="#173d57"/>
      <stop offset="1" stop-color="#0c2438"/>
    </linearGradient>
    <linearGradient id="slot" x1="0" y1="0" x2="0" y2="1">
      <stop offset="0" stop-color="#123448"/>
      <stop offset="1" stop-color="#0a2032"/>
    </linearGradient>
  </defs>

  <!-- PCB substrate -->
  <rect x="0" y="0" width="1180" height="700" fill="url(#board)"/>
  <g stroke="#143a52" stroke-width="1">
    <line x1="0" y1="76" x2="1180" y2="76"/>
    <line x1="0" y1="652" x2="1180" y2="652"/>
  </g>
  <g fill="#16415c">
    <circle cx="40" cy="40" r="2"/><circle cx="1140" cy="40" r="2"/>
    <circle cx="40" cy="672" r="2"/><circle cx="1140" cy="672" r="2"/>
  </g>

  <!-- title -->
  <text x="40" y="44" fill="#eaf6ff" font-size="22" font-weight="700">where to cut</text>
  <text x="248" y="44" fill="#9fc9e0" font-size="15">finding the split points in a compressed stream — the cut itself <tspan fill="#bfe6ff" font-weight="700">runs on N cores</tspan></text>

  <!-- legend -->
  <g font-size="12.5">
    <line x1="744" y1="60" x2="784" y2="60" stroke="#6fd3f5" stroke-width="3"/>
    <text x="792" y="64" fill="#cfe6f5">confirmed boundary</text>
    <line x1="982" y1="60" x2="1022" y2="60" stroke="#ff7a7a" stroke-width="2.5" stroke-dasharray="5 4"/>
    <text x="1030" y="64" fill="#cfe6f5">rejected probe</text>
  </g>

  <!-- ===================== EASY SPLIT (top band) ===================== -->
  <rect x="36" y="100" width="1108" height="184" rx="12" fill="url(#rail)" stroke="#7fc8ea" stroke-width="2"/>
  <text x="60" y="128" fill="#eaf6ff" font-size="15" font-weight="700">EASY split — boundaries are hints in the bitstream</text>
  <text x="60" y="148" fill="#86b3cc" font-size="11">pigz / BGZF flush marker (gzip) · bzip2 block magic · ZIP central directory — a single forward scan lands the cut exactly</text>

  <!-- the compressed stream with markers -->
  <rect x="60" y="170" width="1040" height="40" rx="6" fill="url(#slot)" stroke="#5aa6cf" stroke-width="1.6"/>
  <g font-family="'DejaVu Sans Mono', monospace" font-size="10">
    <!-- markers -->
    <g fill="#6fd3f5">
      <rect x="318" y="170" width="4" height="40"/><rect x="576" y="170" width="4" height="40"/><rect x="834" y="170" width="4" height="40"/>
    </g>
    <text x="320" y="166" fill="#bfe6ff" font-size="9" text-anchor="middle">00 00 FF FF</text>
    <text x="578" y="166" fill="#bfe6ff" font-size="9" text-anchor="middle">00 00 FF FF</text>
    <text x="836" y="166" fill="#bfe6ff" font-size="9" text-anchor="middle">00 00 FF FF</text>
    <text x="190" y="194" fill="#a9d8ee" text-anchor="middle">seg 0</text>
    <text x="448" y="194" fill="#a9d8ee" text-anchor="middle">seg 1</text>
    <text x="706" y="194" fill="#a9d8ee" text-anchor="middle">seg 2</text>
    <text x="968" y="194" fill="#a9d8ee" text-anchor="middle">seg 3</text>
  </g>
  <text x="60" y="234" fill="#7fa8c4" font-size="10">gzip: <tspan fill="#a9d8ee" font-family="'DejaVu Sans Mono', monospace">deflate_scan::find_next_flush</tspan>  ·  bzip2: <tspan fill="#a9d8ee" font-family="'DejaVu Sans Mono', monospace">block_scan::find_next_block</tspan> (48-bit 0x314159265359 at any BIT)  ·  zip: <tspan fill="#a9d8ee" font-family="'DejaVu Sans Mono', monospace">central_dir</tspan> lists every offset</text>
  <text x="60" y="252" fill="#86b3cc" font-size="10.5">each segment is independent &#8594; fan straight out to the workers, no window stitching needed</text>
  <text x="60" y="270" fill="#bfe6ff" font-size="10.5" font-weight="700">the split is cheap &#8212; one scan, done</text>

  <!-- ===================== HARD SPLIT (lower band) ===================== -->
  <rect x="36" y="304" width="1108" height="300" rx="12" fill="url(#rail)" stroke="#7fc8ea" stroke-width="2"/>
  <text x="60" y="332" fill="#eaf6ff" font-size="15" font-weight="700">HARD split — no markers: speculative resync (pugz-style), parallelized</text>
  <text x="60" y="352" fill="#86b3cc" font-size="11">a plain gzip stream has no flush hints. The SPLIT step itself fans across cores &#8212; each guesses an offset and forward-searches.</text>

  <!-- N candidate offsets, each on its own core -->
  <g>
    <rect x="60" y="372" width="248" height="118" rx="9" fill="url(#chip)" stroke="#7fc8ea" stroke-width="2"/>
    <text x="184" y="392" fill="#eaf6ff" font-size="12.5" font-weight="700" text-anchor="middle">core 0</text>
    <text x="184" y="410" fill="#9fc9e0" font-size="9.5" text-anchor="middle">guess nominal offset</text>
    <text x="184" y="428" fill="#86b3cc" font-size="9" text-anchor="middle" font-family="'DejaVu Sans Mono', monospace">find_next_block(...)</text>
    <text x="184" y="444" fill="#86b3cc" font-size="9" text-anchor="middle">forward-search &#8804; 64 KiB</text>
    <text x="184" y="460" fill="#86b3cc" font-size="9" text-anchor="middle">for a stored-block header</text>
    <text x="184" y="478" fill="#a9d8ee" font-size="9" text-anchor="middle" font-family="'DejaVu Sans Mono', monospace">FORWARD_SEARCH_LIMIT</text>

    <rect x="324" y="372" width="248" height="118" rx="9" fill="url(#chip)" stroke="#7fc8ea" stroke-width="2"/>
    <text x="448" y="392" fill="#eaf6ff" font-size="12.5" font-weight="700" text-anchor="middle">core 1</text>
    <text x="448" y="410" fill="#9fc9e0" font-size="9.5" text-anchor="middle">probe_decode candidate</text>
    <text x="448" y="428" fill="#86b3cc" font-size="9" text-anchor="middle">decode &#8805; 4 KiB? confirm.</text>
    <text x="448" y="444" fill="#86b3cc" font-size="9" text-anchor="middle">garbage? reject, scan on.</text>
    <text x="448" y="464" fill="#a9d8ee" font-size="9" text-anchor="middle" font-family="'DejaVu Sans Mono', monospace">PROBE_THRESHOLD=4096</text>
    <text x="448" y="479" fill="#a9d8ee" font-size="9" text-anchor="middle" font-family="'DejaVu Sans Mono', monospace">PROBE_LIMIT=32768</text>
    <!-- a rejected probe mark -->
    <g stroke="#ff7a7a" stroke-width="2.2" stroke-linecap="round">
      <line x1="556" y1="380" x2="566" y2="390"/><line x1="566" y1="380" x2="556" y2="390"/>
    </g>

    <rect x="588" y="372" width="248" height="118" rx="9" fill="url(#chip)" stroke="#7fc8ea" stroke-width="2"/>
    <text x="712" y="392" fill="#eaf6ff" font-size="12.5" font-weight="700" text-anchor="middle">core N&#8722;1</text>
    <text x="712" y="412" fill="#9fc9e0" font-size="9.5" text-anchor="middle">confirms its boundary</text>
    <text x="712" y="430" fill="#86b3cc" font-size="9" text-anchor="middle">N&#8722;1 cores find N&#8722;1 cuts</text>
    <text x="712" y="448" fill="#86b3cc" font-size="9" text-anchor="middle" font-family="'DejaVu Sans Mono', monospace">split_boundaries_parallel</text>
    <text x="712" y="466" fill="#86b3cc" font-size="9" text-anchor="middle">dedup cuts &lt; threshold apart</text>
    <text x="712" y="481" fill="#bfe6ff" font-size="9" text-anchor="middle" font-weight="700">the cut is now parallel</text>
  </g>

  <!-- two-pass window fixup -->
  <rect x="852" y="372" width="280" height="118" rx="9" fill="url(#chip)" stroke="#5aa6cf" stroke-width="2"/>
  <text x="992" y="392" fill="#eaf6ff" font-size="12.5" font-weight="700" text-anchor="middle">two-pass window fixup</text>
  <text x="992" y="412" fill="#9fc9e0" font-size="9.5" text-anchor="middle">pass 1 (parallel): decode every</text>
  <text x="992" y="426" fill="#9fc9e0" font-size="9.5" text-anchor="middle">segment with a ZEROED 32 KiB window</text>
  <text x="992" y="444" fill="#86b3cc" font-size="9.5" text-anchor="middle">back-refs over the cut &#8594; garbage,</text>
  <text x="992" y="458" fill="#86b3cc" font-size="9.5" text-anchor="middle">but lengths are correct</text>
  <text x="992" y="476" fill="#bfe6ff" font-size="9.5" text-anchor="middle">pass 2 (cheap seq): re-decode the</text>
  <text x="992" y="490" fill="#bfe6ff" font-size="9.5" text-anchor="middle" font-family="'DejaVu Sans Mono', monospace">LZ77_WINDOW=32 KiB</text>

  <!-- arrows cores -> fixup -->
  <g stroke="#6fd3f5" stroke-width="2.5" fill="none">
    <path d="M836 431 H852"/>
  </g>

  <!-- 3-tier fallback note -->
  <text x="60" y="528" fill="#dff1ff" font-size="13" font-weight="700">lgz 3-tier fallback (cheapest first)</text>
  <g font-family="'DejaVu Sans Mono', monospace" font-size="10">
    <rect x="60" y="540" width="346" height="26" rx="5" fill="url(#slot)" stroke="#6fd3f5" stroke-width="1.3"/>
    <text x="72" y="557" fill="#bfe6ff">1. decode_concatenated_members</text>
    <text x="398" y="557" fill="#86b3cc" font-size="8.5" text-anchor="end">multi-member 1f 8b</text>
    <rect x="416" y="540" width="346" height="26" rx="5" fill="url(#slot)" stroke="#6fd3f5" stroke-width="1.3"/>
    <text x="428" y="557" fill="#bfe6ff">2. speculative_decode</text>
    <text x="754" y="557" fill="#86b3cc" font-size="8.5" text-anchor="end">resync above &#8594; universal</text>
    <rect x="772" y="540" width="346" height="26" rx="5" fill="#0a2032" stroke="#3c6a86" stroke-width="1.3" stroke-dasharray="3 3"/>
    <text x="784" y="557" fill="#7fa8c4">3. flate2 GzDecoder</text>
    <text x="1110" y="557" fill="#7fa8c4" font-size="8.5" text-anchor="end">single-thread, always works</text>
  </g>
  <text x="60" y="586" fill="#86b3cc" font-size="10">a tier is tried only when the one before it returns <tspan font-family="'DejaVu Sans Mono', monospace" fill="#a9d8ee">None</tspan> — tier 3 is the guaranteed floor</text>

  <!-- ===================== GROUND RAIL ===================== -->
  <rect x="36" y="618" width="1108" height="34" rx="9" fill="url(#rail)" stroke="#7fc8ea" stroke-width="1.6"/>
  <text x="60" y="640" fill="#bcd9ec" font-size="11">EASY: markers are hints, one scan lands the cut &#183; HARD: no markers &#8594; the cut is itself a parallel forward-search + probe-decode + window fixup</text>
</svg>