Files
anonymous_github/backend/reports/regex-optimization.json
T

353 lines
12 KiB
JSON

{
"measuredAt": "2026-11-02T07:33:04.703Z",
"method": "Three fresh processes per version, alternating order; transform only, excludes compilation, I/O, child startup and fixture generation. Same-machine comparison against the Go implementation before regex optimization.",
"comparison": [
{
"name": "2 MB CSV, 47 absent terms",
"beforeMs": 3.218,
"afterMs": 1.525,
"speedup": 2.1101639344262297,
"beforeAllocatedBytes": 288,
"afterAllocatedBytes": 288,
"sha256": "b3882940c0ad7a4f8e1385dcd3e32122c721f26b90144bb820b542e394f379cd"
},
{
"name": "100 MB CSV, 47 absent terms",
"beforeMs": 175.973,
"afterMs": 124.487,
"speedup": 1.4135853542940229,
"beforeAllocatedBytes": 288,
"afterAllocatedBytes": 288,
"sha256": "fcccff214b1f6838f5d9345237f5252cd57e2263fc95640b2a3a5278156eec48"
},
{
"name": "50 MB CSV, sparse matches",
"beforeMs": 919.742,
"afterMs": 600.492,
"speedup": 1.5316473824797001,
"beforeAllocatedBytes": 201661064,
"afterAllocatedBytes": 201624072,
"sha256": "153ce777c4473651a70f3f2f830cac5930214f6b998c08094939646193b0f9f0"
},
{
"name": "22 MB text, 1.2 million replacements",
"beforeMs": 875.731,
"afterMs": 453.834,
"speedup": 1.929628454456916,
"beforeAllocatedBytes": 114614880,
"afterAllocatedBytes": 114614880,
"sha256": "4e649aee83a6f15cb7178f725991ff5405affe013b0bba0b6eda18689c5c0249"
}
],
"samples": [
{
"run": 0,
"implementation": "before",
"allocatedBytes": 288,
"compileMs": 9.097,
"inputBytes": 1960000,
"matchMs": 3.136,
"name": "2 MB CSV, 47 absent terms",
"outputBytes": 1960000,
"runtime": "go1.27.3",
"sha256": "b3882940c0ad7a4f8e1385dcd3e32122c721f26b90144bb820b542e394f379cd"
},
{
"run": 0,
"implementation": "before",
"allocatedBytes": 288,
"compileMs": 10.354,
"inputBytes": 100800000,
"matchMs": 203.147,
"name": "100 MB CSV, 47 absent terms",
"outputBytes": 100800000,
"runtime": "go1.27.3",
"sha256": "fcccff214b1f6838f5d9345237f5252cd57e2263fc95640b2a3a5278156eec48"
},
{
"run": 0,
"implementation": "before",
"allocatedBytes": 201661064,
"compileMs": 4.664,
"inputBytes": 50400041,
"matchMs": 957.791,
"name": "50 MB CSV, sparse matches",
"outputBytes": 50400014,
"runtime": "go1.27.3",
"sha256": "153ce777c4473651a70f3f2f830cac5930214f6b998c08094939646193b0f9f0"
},
{
"run": 0,
"implementation": "before",
"allocatedBytes": 114614848,
"compileMs": 3.713,
"inputBytes": 21600000,
"matchMs": 875.731,
"name": "22 MB text, 1.2 million replacements",
"outputBytes": 19800000,
"runtime": "go1.27.3",
"sha256": "4e649aee83a6f15cb7178f725991ff5405affe013b0bba0b6eda18689c5c0249"
},
{
"run": 0,
"implementation": "after",
"allocatedBytes": 288,
"compileMs": 10.102,
"inputBytes": 1960000,
"matchMs": 2.863,
"name": "2 MB CSV, 47 absent terms",
"outputBytes": 1960000,
"runtime": "go1.27.3",
"sha256": "b3882940c0ad7a4f8e1385dcd3e32122c721f26b90144bb820b542e394f379cd"
},
{
"run": 0,
"implementation": "after",
"allocatedBytes": 288,
"compileMs": 4.549,
"inputBytes": 100800000,
"matchMs": 82.94,
"name": "100 MB CSV, 47 absent terms",
"outputBytes": 100800000,
"runtime": "go1.27.3",
"sha256": "fcccff214b1f6838f5d9345237f5252cd57e2263fc95640b2a3a5278156eec48"
},
{
"run": 0,
"implementation": "after",
"allocatedBytes": 201624072,
"compileMs": 3.034,
"inputBytes": 50400041,
"matchMs": 296.682,
"name": "50 MB CSV, sparse matches",
"outputBytes": 50400014,
"runtime": "go1.27.3",
"sha256": "153ce777c4473651a70f3f2f830cac5930214f6b998c08094939646193b0f9f0"
},
{
"run": 0,
"implementation": "after",
"allocatedBytes": 114614864,
"compileMs": 2.689,
"inputBytes": 21600000,
"matchMs": 455.418,
"name": "22 MB text, 1.2 million replacements",
"outputBytes": 19800000,
"runtime": "go1.27.3",
"sha256": "4e649aee83a6f15cb7178f725991ff5405affe013b0bba0b6eda18689c5c0249"
},
{
"run": 1,
"implementation": "after",
"allocatedBytes": 288,
"compileMs": 5.485,
"inputBytes": 1960000,
"matchMs": 1.525,
"name": "2 MB CSV, 47 absent terms",
"outputBytes": 1960000,
"runtime": "go1.27.3",
"sha256": "b3882940c0ad7a4f8e1385dcd3e32122c721f26b90144bb820b542e394f379cd"
},
{
"run": 1,
"implementation": "after",
"allocatedBytes": 288,
"compileMs": 6.841,
"inputBytes": 100800000,
"matchMs": 138.824,
"name": "100 MB CSV, 47 absent terms",
"outputBytes": 100800000,
"runtime": "go1.27.3",
"sha256": "fcccff214b1f6838f5d9345237f5252cd57e2263fc95640b2a3a5278156eec48"
},
{
"run": 1,
"implementation": "after",
"allocatedBytes": 201623976,
"compileMs": 4.81,
"inputBytes": 50400041,
"matchMs": 600.492,
"name": "50 MB CSV, sparse matches",
"outputBytes": 50400014,
"runtime": "go1.27.3",
"sha256": "153ce777c4473651a70f3f2f830cac5930214f6b998c08094939646193b0f9f0"
},
{
"run": 1,
"implementation": "after",
"allocatedBytes": 114614896,
"compileMs": 2.816,
"inputBytes": 21600000,
"matchMs": 453.834,
"name": "22 MB text, 1.2 million replacements",
"outputBytes": 19800000,
"runtime": "go1.27.3",
"sha256": "4e649aee83a6f15cb7178f725991ff5405affe013b0bba0b6eda18689c5c0249"
},
{
"run": 1,
"implementation": "before",
"allocatedBytes": 288,
"compileMs": 7.594,
"inputBytes": 1960000,
"matchMs": 3.36,
"name": "2 MB CSV, 47 absent terms",
"outputBytes": 1960000,
"runtime": "go1.27.3",
"sha256": "b3882940c0ad7a4f8e1385dcd3e32122c721f26b90144bb820b542e394f379cd"
},
{
"run": 1,
"implementation": "before",
"allocatedBytes": 288,
"compileMs": 5.655,
"inputBytes": 100800000,
"matchMs": 175.973,
"name": "100 MB CSV, 47 absent terms",
"outputBytes": 100800000,
"runtime": "go1.27.3",
"sha256": "fcccff214b1f6838f5d9345237f5252cd57e2263fc95640b2a3a5278156eec48"
},
{
"run": 1,
"implementation": "before",
"allocatedBytes": 201629312,
"compileMs": 3.157,
"inputBytes": 50400041,
"matchMs": 603.6,
"name": "50 MB CSV, sparse matches",
"outputBytes": 50400014,
"runtime": "go1.27.3",
"sha256": "153ce777c4473651a70f3f2f830cac5930214f6b998c08094939646193b0f9f0"
},
{
"run": 1,
"implementation": "before",
"allocatedBytes": 114614880,
"compileMs": 5.679,
"inputBytes": 21600000,
"matchMs": 1216.761,
"name": "22 MB text, 1.2 million replacements",
"outputBytes": 19800000,
"runtime": "go1.27.3",
"sha256": "4e649aee83a6f15cb7178f725991ff5405affe013b0bba0b6eda18689c5c0249"
},
{
"run": 2,
"implementation": "before",
"allocatedBytes": 288,
"compileMs": 7.188,
"inputBytes": 1960000,
"matchMs": 3.218,
"name": "2 MB CSV, 47 absent terms",
"outputBytes": 1960000,
"runtime": "go1.27.3",
"sha256": "b3882940c0ad7a4f8e1385dcd3e32122c721f26b90144bb820b542e394f379cd"
},
{
"run": 2,
"implementation": "before",
"allocatedBytes": 288,
"compileMs": 7.061,
"inputBytes": 100800000,
"matchMs": 145.195,
"name": "100 MB CSV, 47 absent terms",
"outputBytes": 100800000,
"runtime": "go1.27.3",
"sha256": "fcccff214b1f6838f5d9345237f5252cd57e2263fc95640b2a3a5278156eec48"
},
{
"run": 2,
"implementation": "before",
"allocatedBytes": 201666368,
"compileMs": 5.81,
"inputBytes": 50400041,
"matchMs": 919.742,
"name": "50 MB CSV, sparse matches",
"outputBytes": 50400014,
"runtime": "go1.27.3",
"sha256": "153ce777c4473651a70f3f2f830cac5930214f6b998c08094939646193b0f9f0"
},
{
"run": 2,
"implementation": "before",
"allocatedBytes": 114614880,
"compileMs": 3.669,
"inputBytes": 21600000,
"matchMs": 718.816,
"name": "22 MB text, 1.2 million replacements",
"outputBytes": 19800000,
"runtime": "go1.27.3",
"sha256": "4e649aee83a6f15cb7178f725991ff5405affe013b0bba0b6eda18689c5c0249"
},
{
"run": 2,
"implementation": "after",
"allocatedBytes": 288,
"compileMs": 4.708,
"inputBytes": 1960000,
"matchMs": 1.346,
"name": "2 MB CSV, 47 absent terms",
"outputBytes": 1960000,
"runtime": "go1.27.3",
"sha256": "b3882940c0ad7a4f8e1385dcd3e32122c721f26b90144bb820b542e394f379cd"
},
{
"run": 2,
"implementation": "after",
"allocatedBytes": 288,
"compileMs": 5.439,
"inputBytes": 100800000,
"matchMs": 124.487,
"name": "100 MB CSV, 47 absent terms",
"outputBytes": 100800000,
"runtime": "go1.27.3",
"sha256": "fcccff214b1f6838f5d9345237f5252cd57e2263fc95640b2a3a5278156eec48"
},
{
"run": 2,
"implementation": "after",
"allocatedBytes": 201666384,
"compileMs": 5.863,
"inputBytes": 50400041,
"matchMs": 703.321,
"name": "50 MB CSV, sparse matches",
"outputBytes": 50400014,
"runtime": "go1.27.3",
"sha256": "153ce777c4473651a70f3f2f830cac5930214f6b998c08094939646193b0f9f0"
},
{
"run": 2,
"implementation": "after",
"allocatedBytes": 114614880,
"compileMs": 3.742,
"inputBytes": 21600000,
"matchMs": 331.288,
"name": "22 MB text, 1.2 million replacements",
"outputBytes": 19800000,
"runtime": "go1.27.3",
"sha256": "4e649aee83a6f15cb7178f725991ff5405affe013b0bba0b6eda18689c5c0249"
}
],
"sourceHashes": {
"beforeAnonymizeGo": "19265cbb3dfb614445cf1989bfc5db230e3a4a6099ba55a84a48a4908dddbe93",
"afterAnonymizeGo": "7fb42bcfb844c3de816b736f6f49c12a618aadeb1885c8b237cacccc36e94af7",
"afterBoundariesGo": "6c679eb3d350090263e8038bb2797c2e20eb509c4e95c74184d326bcc72679c6"
},
"fallbackBenchmarks": {
"method": "Go benchmarks, three iterations per fixture and version; 2.2 MB Unicode input with a match at the end. Allocated bytes are total allocations per operation, not peak RSS.",
"before": "goos: linux\ngoarch: amd64\npkg: github.com/tdurieux/anonymous_github/backend/internal/anonymize\ncpu: Intel Xeon E312xx (Sandy Bridge, IBRS update)\nBenchmarkFallbackOffsets-12 \t 3\t 385498159 ns/op\t 5.71 MB/s\t59815184 B/op\t 25 allocs/op\nBenchmarkFallbackLookaround-12 \t 3\t 337738925 ns/op\t 6.51 MB/s\t59811541 B/op\t 18 allocs/op\nPASS\nok \tgithub.com/tdurieux/anonymous_github/backend/internal/anonymize\t2.212s\n",
"after": "goos: linux\ngoarch: amd64\npkg: github.com/tdurieux/anonymous_github/backend/internal/anonymize\ncpu: Intel Xeon E312xx (Sandy Bridge, IBRS update)\nBenchmarkFallbackOffsets-12 \t 3\t 441831684 ns/op\t 4.98 MB/s\t16607866 B/op\t 16 allocs/op\nBenchmarkFallbackLookaround-12 \t 3\t 262234106 ns/op\t 8.39 MB/s\t16606917 B/op\t 14 allocs/op\nPASS\nok \tgithub.com/tdurieux/anonymous_github/backend/internal/anonymize\t2.150s\n",
"boundaryCorrectionTradeoff": "The boundary-bearing fallback fixture increased from 385.50 to 441.83 ms while allocation fell from 59.82 to 16.61 MB. The lookaround-only fixture improved from 337.74 to 262.23 ms with the same allocation reduction."
},
"validation": {
"differentialCases": 499,
"passed": 499,
"previouslyFailingCasesFixed": 5,
"integrationRaceTests": "passed using disposable MongoDB and Redis",
"fuzzExecutions": 37094,
"fuzzSeconds": 10,
"goVet": "passed"
}
}