Files
mach_examples/10-boot-time-compilation.svg
2026-05-23 16:18:11 -05:00

83 lines
4.8 KiB
XML

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 760 300" width="760" height="300">
<rect width="760" height="300" fill="#09080f"/>
<defs>
<linearGradient id="bootG" x1="0" y1="0" x2="1" y2="0">
<stop offset="0%" stop-color="#7c3aed"/>
<stop offset="100%" stop-color="#a855f7"/>
</linearGradient>
<linearGradient id="warmG" x1="0" y1="0" x2="1" y2="0">
<stop offset="0%" stop-color="#f59e0b"/>
<stop offset="100%" stop-color="#fbbf24"/>
</linearGradient>
<linearGradient id="runG" x1="0" y1="0" x2="1" y2="0">
<stop offset="0%" stop-color="#10b981"/>
<stop offset="100%" stop-color="#34d399"/>
</linearGradient>
<style>text{font-family:'JetBrains Mono','Fira Code',monospace}</style>
</defs>
<text x="380" y="28" text-anchor="middle" fill="#e2e8f0" font-size="13" font-weight="700">Boot-Time Compilation</text>
<!-- Phase 1: config() -->
<rect x="30" y="50" width="200" height="110" rx="10" fill="#1e1b2e" stroke="#7c3aed" stroke-width="1.5"/>
<rect x="30" y="50" width="200" height="32" rx="10" fill="url(#bootG)"/>
<text x="130" y="71" text-anchor="middle" fill="#fff" font-size="11" font-weight="700">config mach()</text>
<text x="50" y="96" fill="#c4b5fd" font-size="9">.includes</text>
<text x="50" y="112" fill="#c4b5fd" font-size="9">.databases</text>
<text x="50" y="128" fill="#c4b5fd" font-size="9">.resources</text>
<text x="50" y="144" fill="#c4b5fd" font-size="9">.events / .errors</text>
<!-- Arrow 1 -->
<line x1="230" y1="105" x2="268" y2="105" stroke="#64748b" stroke-width="1.5"/>
<polygon points="278,105 268,100 268,110" fill="#64748b"/>
<!-- Phase 2: Precompile -->
<rect x="278" y="50" width="200" height="110" rx="10" fill="#1e1b2e" stroke="#f59e0b" stroke-width="1.5"/>
<rect x="278" y="50" width="200" height="32" rx="10" fill="url(#warmG)"/>
<text x="378" y="71" text-anchor="middle" fill="#1e1b2e" font-size="11" font-weight="700">Precompile</text>
<text x="298" y="96" fill="#fcd34d" font-size="9">Compile pipelines</text>
<text x="298" y="112" fill="#fcd34d" font-size="9">Compile templates</text>
<text x="298" y="128" fill="#fcd34d" font-size="9">Prepare SQL statements</text>
<text x="298" y="144" fill="#fcd34d" font-size="9">Build route table</text>
<!-- Arrow 2 -->
<line x1="478" y1="105" x2="516" y2="105" stroke="#64748b" stroke-width="1.5"/>
<polygon points="526,105 516,100 516,110" fill="#64748b"/>
<!-- Phase 3: Execution Graph -->
<rect x="526" y="50" width="200" height="110" rx="10" fill="#1e1b2e" stroke="#10b981" stroke-width="1.5"/>
<rect x="526" y="50" width="200" height="32" rx="10" fill="url(#runG)"/>
<text x="626" y="71" text-anchor="middle" fill="#fff" font-size="11" font-weight="700">Execution Graph</text>
<text x="546" y="96" fill="#6ee7b7" font-size="9">Pre-warmed pipelines</text>
<text x="546" y="112" fill="#6ee7b7" font-size="9">Optimized query plans</text>
<text x="546" y="128" fill="#6ee7b7" font-size="9">Compiled templates</text>
<text x="546" y="144" fill="#6ee7b7" font-size="9">Ready to serve</text>
<!-- Phase labels -->
<text x="130" y="180" text-anchor="middle" fill="#7c3aed" font-size="9" font-weight="600">RUNS ONCE AT BOOT</text>
<text x="378" y="180" text-anchor="middle" fill="#f59e0b" font-size="9" font-weight="600">RUNS ONCE AT BOOT</text>
<text x="626" y="180" text-anchor="middle" fill="#10b981" font-size="9" font-weight="600">SERVES ALL REQUESTS</text>
<!-- Runtime section -->
<rect x="30" y="200" width="696" height="76" rx="10" fill="#0f0d1a" stroke="#10b981" stroke-width="1" stroke-dasharray="5,3"/>
<text x="50" y="224" fill="#6ee7b7" font-size="10" font-weight="600">Runtime: each request executes a pre-warmed pipeline</text>
<!-- Request arrows -->
<text x="50" y="248" fill="#475569" font-size="9">req →</text>
<rect x="90" y="236" width="80" height="24" rx="4" fill="#1e293b" stroke="#10b981" stroke-width="0.75"/>
<text x="130" y="252" text-anchor="middle" fill="#6ee7b7" font-size="9">pipeline</text>
<line x1="170" y1="248" x2="184" y2="248" stroke="#10b981" stroke-width="1"/>
<polygon points="192,248 184,244 184,252" fill="#10b981"/>
<text x="200" y="252" fill="#475569" font-size="9">→ response</text>
<text x="320" y="248" fill="#475569" font-size="9">req →</text>
<rect x="360" y="236" width="80" height="24" rx="4" fill="#1e293b" stroke="#10b981" stroke-width="0.75"/>
<text x="400" y="252" text-anchor="middle" fill="#6ee7b7" font-size="9">pipeline</text>
<line x1="440" y1="248" x2="454" y2="248" stroke="#10b981" stroke-width="1"/>
<polygon points="462,248 454,244 454,252" fill="#10b981"/>
<text x="470" y="252" fill="#475569" font-size="9">→ response</text>
<!-- Footer -->
<text x="380" y="296" text-anchor="middle" fill="#64748b" font-size="10">Zero per-request compilation — config builds the graph, requests just execute it</text>
</svg>