canontra-0.4.0.0: benchmarkReport.md
# Canontra Empirical Benchmark Report & Scientific Evaluation (Version 4)
**A Formal Investigation into Ultra-Low-Latency Semantic Hashing, ByteString/SIMD Parsing, `CNTR\x07` Incremental Graph Caching, Hardened Type Contracts, and Stateless AI Harness Sub-Versioning**
* **Report Version**: 4
* **Lead Author / Principal Investigator**: Jash Thakkar & SymtraceLabs Research Team
* **Implementation**: Canontra `v0.4.0.0` (Release `v0.4.0`, `dist-bin/canontra.exe` compiled via GHC 9.6.6 with `-O2`)
* **Evaluation Date**: December 1, 2026
* **Testbed Environment**:
* **Host Operating System**: Windows 11 (NTFS filesystem)
* **Processors / Capabilities**: Multi-core x86_64 hardware with Haskell GHC SMP work-stealing scheduler (`+RTS -N`)
* **Measurement Methodology Upgrade (`v0.4.0`)**:
* `run_v0.4.0_benchmarks.ps1` replaces PowerShell `Start-Process -Wait` (which introduced a ~1,000 ms polling quantization floor in `v0.3.0`) with direct `.NET System.Diagnostics.Process` (`ProcessStartInfo` + async stream capture) timed via high-resolution `[System.Diagnostics.Stopwatch]`.
* Microbenchmarks in `bench/Bench.hs` (`RQ1`–`RQ19`, 159 benchmarks) enforce strict full-spine `NFData` (`nf`) evaluation.
* **Live Evaluated Reference Baselines (`v0.3.0` Corpus)**:
* **Canontra**: `v0.4.0.0` (`dist-bin/canontra.exe`) vs `v0.3.0.0` baselines
* **GitHub CodeQL**: v2.27.0 CLI (`codeql.exe`)
* **Git**: v2.48.1 (`git hash-object`), **Turborepo** v2.11.2, **Mozilla sccache** v0.8.2 (preserved from identical 15-repo corpus runs in [`researchBenchmarks/v0.3.0_benchmark_comparative_summary.csv`](file:///d:/barista/canontra/researchBenchmarks/v0.3.0_benchmark_comparative_summary.csv))
* **Corpus Scale**: 15 Real-World Open-Source Repositories, **3,182 source files** (`3,097` indexed), **1,026,521 lines of code (LOC)** (counted via `.NET [System.IO.File]::ReadAllLines().Length`)
* **Methodological Integrity**: Zero simulated baseline values; every Canontra `v0.4.0` latency, throughput, hash, and exit code reflects live `-O2` process execution captured cleanly with `.canontra/` reset before cold runs and deleted after evaluation.
## 1. Executive Summary
This report presents empirical measurements for **Canontra `v0.4.0.0` (Release `v0.4.0`)**, covering Phases 1–5 engineering upgrades across 15 production repositories and 159 `tasty-bench` microbenchmarks:
1. **Single-Pass Pipeline Fusion & $O(N^2)$ Removal**: Unified `CanonicalProgram` (`Canontra.Normalize.Normalize`), single-parse `computeManifest`, `Set`/`IntMap` deduplication in `WholeRepoGraph` and `TypeContract`, mutable `MV.IOVector` Chase-Lev deques (`1.14 ms` for 1,000 tasks in RQ15), and ByteString/SIMD lexers (`95.4 us` Go, `137.3 us` JS/TS, `463.9 us` FastPython BS).
2. **4.07× Cold & 9.07× Warm Total Corpus Speedup vs `v0.3.0`**: Across all 15 repositories (`1,026,521` LOC), aggregate cold ingestion dropped from **`135,201.09 ms`** (`135.20 s`) to **`33,181.10 ms`** (`33.18 s`), and aggregate warm ingestion dropped from **`129,102.05 ms`** (`129.10 s`) to **`14,228.02 ms`** (`14.23 s`). Peak cold throughput reached **`68,030 LOC/s`** (`jinja`), with **`59,328 LOC/s`** (`click`) and **`54,996 LOC/s`** (`marshmallow`).
3. **`CNTR\x07` Incremental Slab Cache (`Canontra.Cache.SlabV7`)**: Persists per-file `FileGraphSummary` binary payloads inside 4KB CRC-32C protected slab pages. Summary-backed graph synthesis (`RQ18`) runs in **`112.9 us`** (`F_WCG`) and **`65.6 us`** (`F_WDF`) on 10 modules (**87.3×** and **180.2×** faster than full-AST CSR rebuilding). End-to-end CLI warm caching accelerated `prometheus` (994 files, 408k LOC) by **15.18×** (`57,478.64 ms` $\to$ `3,786.11 ms`), `ripgrep` by **10.40×**, and `gin` by **8.28×**.
4. **9.7× to 205.1× Faster Cold Indexing than GitHub CodeQL**: On `ripgrep`, Canontra `v0.4.0` finished cold indexing in **`1.216 s`** vs CodeQL's **`249.391 s`** (**205.1× faster**); on 408k-LOC `prometheus`, Canontra finished cold in **`12.028 s`** (**86.7× faster**) and warm in **`3.786 s`** (**275.5× faster**) than CodeQL (`1,043.217 s`).
5. **Stateless AI Harness Sub-Versioning (`canontra snap` — Alpha, `0.1-alpha`)**: In-memory 1,000-file snapshot delta checks complete in **`1.73 ms`** (`RQ19`), single-bundle diffs in **`733.1 ns`**, and end-to-end warm CLI `snap mark --skip-noop` invocations complete in **`143.61 ms` – `571.66 ms`** on typical repos (and **`3,978.55 ms`** on 994-file `prometheus`).
6. **100% Execution Reliability**: Zero panics, zero uncaught exceptions, zero null graph digests, and **exit code 0 across all 15 cold, warm, CIA, and `snap` runs**.
## 2. Live Empirical Benchmark Dataset (15 Repositories)
Executed via [`researchBenchmarks/run_v0.4.0_benchmarks.ps1`](file:///d:/barista/canontra/researchBenchmarks/run_v0.4.0_benchmarks.ps1) against [`dist-bin/canontra.exe`](file:///d:/barista/canontra/dist-bin/canontra.exe) (`v0.4.0`).
### Table 1: Canontra `v0.4.0` Ingestion, Warm Cache, CIA 2.0 & `canontra snap` Latency
| Repository | Language | Source Files | Indexed | Total LOC | Cold Latency (`v0.4.0`) | Cold vs `v0.3.0` | Warm Latency (`v0.4.0`) | Warm vs `v0.3.0` | CIA 2.0 (ms) | `snap mark` Warm (ms) | Cold LOC/s | $F_R$ / $F_{WCG}$ / $F_{WDF}$ Prefixes | Exit |
| :--- | :--- | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :--- | :---: |
| **`bottle`** | Python | 30 | 16 | 9,228 | **339.50 ms** | 3.03× | **290.75 ms** | 3.52× | 462.49 | 325.56 | 27,181 | `066eea6c` / `d0a9f78b` / `3960c7c4` | 0 |
| **`toml`** | Rust | 166 | 166 | 49,698 | **2,291.04 ms** | 2.64× | **1,186.62 ms** | 4.25× | 2,375.24 | 1,288.91 | 21,692 | `f6319c62` / `5445b3e3` / `8dff8088` | 0 |
| **`requests`** | Python | 37 | 21 | 12,032 | **335.08 ms** | 3.02× | **276.05 ms** | 3.66× | 453.52 | 290.19 | 35,908 | `4f6ca7d7` / `f87e69b2` / `7a3f9935` | 0 |
| **`flask`** | Python | 83 | 43 | 18,345 | **607.21 ms** | 3.34× | **435.56 ms** | 4.63× | 761.26 | 440.52 | 30,212 | `91de3959` / `8ec8440f` / `9af98251` | 0 |
| **`marshmallow`** | Python | 38 | 17 | 15,704 | **285.55 ms** | 3.54× | **245.70 ms** | 4.19× | 508.29 | 301.55 | 54,996 | `d004bdec` / `fc571f2c` / `781892b2` | 0 |
| **`chalk`** | JavaScript | 20 | 14 | 2,215 | **135.64 ms** | 7.56× | **103.50 ms** | 9.81× | 287.29 | 143.61 | 16,330 | `34785a97` / `dd544702` / `96c58d9d` | 0 |
| **`click`** | Python | 90 | 54 | 29,121 | **490.85 ms** | 4.12× | **362.07 ms** | 5.57× | 765.02 | 408.79 | 59,328 | `ecccb6e8` / `0e4f5e07` / `5c53bbe9` | 0 |
| **`gin`** | Go | 99 | 99 | 24,226 | **763.45 ms** | 2.65× | **243.88 ms** | 8.28× | 943.15 | 356.78 | 31,732 | `35cbeb98` / `d5daf51d` / `61d355d7` | 0 |
| **`jinja`** | Python | 60 | 25 | 22,875 | **336.25 ms** | 3.01× | **300.64 ms** | 3.38× | 619.61 | 350.97 | **68,030** | `4a5080b6` / `5db1aaea` / `d544cbe3` | 0 |
| **`ripgrep`** | Rust | 110 | 110 | 56,386 | **1,216.22 ms** | 3.32× | **388.11 ms** | 10.40× | 1,632.35 | 477.16 | 46,362 | `4cf1916d` / `049b8842` / `33dc85a7` | 0 |
| **`express`** | JavaScript | 141 | 141 | 21,492 | **1,201.91 ms** | 3.37× | **520.51 ms** | 3.90× | 792.88 | 571.66 | 17,882 | `d15eb48a` / `22f20ad6` / `4c2972c3` | 0 |
| **`rich`** | Python | 213 | 142 | 51,866 | **1,297.27 ms** | **12.43×** | **1,301.98 ms*** | **12.39×** | 4,790.27 | 1,215.36 | 39,981 | `d09ca131` / `35186942` / `65e74c80` | 0 |
| **`hugo`** | Go | 936 | 937 | 235,224 | **9,054.14 ms** | 3.45× | **3,672.67 ms** | 7.68× | 9,106.94 | 5,022.56 | 25,980 | `57209ce8` / `c1b74b39` / `7be96a1f` | 0 |
| **`deno_core`** | TS/Rust | 315 | 318 | 69,692 | **2,799.02 ms** | 1.80× | **1,113.87 ms** | 4.53× | 3,144.59 | 1,352.99 | 24,899 | `bad5e9ce` / `ecc8b549` / `0298785d` | 0 |
| **`prometheus`** | Go | 844 | 994 | 408,417 | **12,027.97 ms** | 4.78× | **3,786.11 ms** | **15.18×** | 11,577.51 | 3,978.55 | 33,956 | `9571da7d` / `2c30a945` / `f00cbbf7` | 0 |
| **Total / Corpus** | **5 Langs** | **3,182** | **3,097** | **1,026,521** | **33,181.10 ms** | **4.07×** | **14,228.02 ms** | **9.07×** | — | — | — | 15 / 15 non-null digests | **0** |
*\*Note on `rich`: 142 of 213 files in `rich` parse and cache into `.canontra/cache.bin`; the remaining 71 test/fixture/doc files with parse warnings are re-checked during warm traversal, yielding `1,301.98 ms` warm vs `1,297.27 ms` cold (`12.39×` faster than `v0.3.0`'s `16,133.07 ms`).*
*Note on `v0.4.0` digests: $F_R$ now incorporates per-module composite $F_4$ digests, $F_{WCG}$ merges Go package directories and TS/JS barrel exports cleanly, and $F_T$ encodes exact ABI scalar widths and mutability, producing distinct `v0.4.0` cryptographic digests relative to `v0.3.0`.*
*Data source: [`researchBenchmarks/v0.4.0_benchmark_summary.csv`](file:///d:/barista/canontra/researchBenchmarks/v0.4.0_benchmark_summary.csv).*
## 3. Live Comparative Benchmark Evaluation across Tools
### Table 2: Comparative Cold Latency (Wall-Clock Seconds)
| Repository | Language | Files | LOC | Canontra `v0.4.0` (s) | Throughput (LOC/s) | Git Hashing (s) | Turborepo (s) | Sccache (s) | CodeQL CLI (s) | Speedup vs CodeQL |
| :--- | :--- | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
| **`bottle`** | Python | 30 | 9,228 | **0.340 s** | 27,181 | 1.456 s | 0.031 s | N/A | 18.052 s | **53.1×** |
| **`toml`** | Rust | 166 | 49,698 | **2.291 s** | 21,692 | 7.909 s | 0.177 s | 3.308 s | 279.388 s | **122.0×** |
| **`requests`** | Python | 37 | 12,032 | **0.335 s** | 35,908 | 2.514 s | 0.039 s | N/A | 18.054 s | **53.9×** |
| **`flask`** | Python | 83 | 18,345 | **0.607 s** | 30,212 | 4.212 s | 0.056 s | N/A | 19.060 s | **31.4×** |
| **`marshmallow`** | Python | 38 | 15,704 | **0.286 s** | 54,996 | 1.795 s | 0.051 s | N/A | 17.093 s | **59.8×** |
| **`chalk`** | JavaScript | 20 | 2,215 | **0.136 s** | 16,330 | 0.695 s | 0.140 s | N/A | 22.040 s | **162.1×** |
| **`click`** | Python | 90 | 29,121 | **0.491 s** | 59,328 | 4.074 s | 0.095 s | N/A | 19.057 s | **38.8×** |
| **`gin`** | Go | 99 | 24,226 | **0.763 s** | 31,732 | 4.525 s | 0.082 s | 2.626 s | 25.045 s | **32.8×** |
| **`jinja`** | Python | 60 | 22,875 | **0.336 s** | **68,030** | 2.699 s | 0.075 s | N/A | 19.059 s | **56.7×** |
| **`ripgrep`** | Rust | 110 | 56,386 | **1.216 s** | 46,362 | 4.931 s | 0.204 s | 3.493 s | 249.391 s | **205.1×** |
| **`express`** | JavaScript | 141 | 21,492 | **1.202 s** | 17,882 | 6.732 s | 1.365 s | N/A | 26.056 s | **21.7×** |
| **`rich`** | Python | 213 | 51,866 | **1.297 s** | 39,981 | 9.882 s | 0.183 s | N/A | 29.100 s | **22.4×** |
| **`hugo`** | Go | 936 | 235,224 | **9.054 s** | 25,980 | 42.110 s | 0.812 s | 9.262 s | 266.449 s | **29.4×** |
| **`deno_core`** | TS/Rust | 315 | 69,692 | **2.799 s** | 24,899 | 14.516 s | 1.151 s | 3.829 s | 27.050 s | **9.7×** |
| **`prometheus`** | Go | 844 | 408,417 | **12.028 s** | 33,956 | 47.279 s | 1.552 s | 14.640 s | 1,043.217 s | **86.7×** |
*Data source: [`researchBenchmarks/v0.4.0_benchmark_comparative_summary.csv`](file:///d:/barista/canontra/researchBenchmarks/v0.4.0_benchmark_comparative_summary.csv).*
## 4. Key Micro-Benchmarks (`tasty-bench`, `v0.4.0` Strict `NFData`)
Measured via `canontra-bench` under GHC 9.6.6 `-O2` (full 159-row dataset in [`researchBenchmarks/v0.4.0_microbench_results.csv`](file:///d:/barista/canontra/researchBenchmarks/v0.4.0_microbench_results.csv)):
```text
RQ18: v0.4.0 SlabV7 & Summary Synthesis (10 modules)
encodeSlabV7Binary (10 modules): 671.4 us (± 902.7 us)
decodeSlabV7Binary (10 modules): 216.7 us (± 205.7 us)
lookupSlabV7BinaryBS (Warm Hit): 6.0 us (± 3.4 us)
buildWholeRepoCallGraphFromSummaries (10 mods): 112.9 us (± 34.6 us)
buildWholeRepoDataFlowFromSummaries (10 mods): 65.6 us (± 20.7 us)
RQ19: v0.4.0 Stateless AI Harness Sub-Versioning (canontra snap)
diffFileBundles (9-tier bundle comparison): 733.1 ns (± 588.4 ns)
computeFileDeltas (1,000 files, 1 dirty): 1.73 ms (± 1.21 ms)
classifySnapDeltas (dirty delta triage): 19.9 ns (± 3.4 ns)
parseGuardTiers (F2,F3,F_T): 733.1 ns (± 241.8 ns)
matchesGlob (**/*.py): 5.9 us (± 7.9 us)
```
For RQ1–RQ17 tables and methodology, see [`BENCHMARKS.md`](file:///d:/barista/canontra/BENCHMARKS.md).
## 5. Preserved Artifacts & Verification Status
All experimental artifacts are generated from live runs and tracked in the repository:
1. **Definitive Report**: [`benchmarkReport.md`](file:///d:/barista/canontra/benchmarkReport.md)
2. **Microbenchmark Reference**: [`BENCHMARKS.md`](file:///d:/barista/canontra/BENCHMARKS.md)
3. **AI Harness Guide (Alpha)**: [`HARNESS.md`](file:///d:/barista/canontra/HARNESS.md)
4. **`v0.4.0` 15-Repo Summary CSV**: [`researchBenchmarks/v0.4.0_benchmark_summary.csv`](file:///d:/barista/canontra/researchBenchmarks/v0.4.0_benchmark_summary.csv)
5. **`v0.4.0` Comparative Summary CSV**: [`researchBenchmarks/v0.4.0_benchmark_comparative_summary.csv`](file:///d:/barista/canontra/researchBenchmarks/v0.4.0_benchmark_comparative_summary.csv)
6. **`v0.4.0` `tasty-bench` CSV (159 rows)**: [`researchBenchmarks/v0.4.0_microbench_results.csv`](file:///d:/barista/canontra/researchBenchmarks/v0.4.0_microbench_results.csv)
7. **Live Multi-Repository Benchmark Runner**: [`researchBenchmarks/run_v0.4.0_benchmarks.ps1`](file:///d:/barista/canontra/researchBenchmarks/run_v0.4.0_benchmarks.ps1)
8. **Production Binary**: `dist-bin/canontra.exe` (`canontra version 0.4.0`)