Breakwater

Codeflash / micropie#3

⚡️ Speed up method Server._parse_cookies by 6%

hoopinwhoopin/micropie#3 · merged 2025-02-03 · base b760304db8 → head 19ce2334b6 · ran on Sandboxes

REVIEW

A valid input family runs 1.60× the instructions of the old code.

Performance · App()#_parse_cookies

Worst family with mostly valid inputs: 1.60× the instructions of base (many_empty_segments).

head slowerhead faster1×1.2×1.4×1.7×101001,00010,000input size (characters)F5F5: 1.03× at ~7 charsF5: 1.04× at ~9 charsF5: 1.10× at ~21 charsF5: 1.24× at ~69 charsF5: 1.46× at ~261 charsF5: 1.60× at ~1,029 charsF5: 1.60× at ~4,101 charsF4F4: 1.02× at ~13 charsF4: 1.03× at ~23 charsF4: 1.08× at ~89 charsF4: 1.20× at ~377 charsF4: 1.32× at ~1,685 charsF4: 1.37× at ~7,085 charsF4: 1.37× at ~31,661 charsF6F6: 1.02× at ~15 charsF6: 1.03× at ~27 charsF6: 1.08× at ~105 charsF6: 1.20× at ~441 charsF6: 1.31× at ~1,941 charsF6: 1.37× at ~8,109 charsF6: 1.36× at ~35,757 charsF4.1F4.1: 1.02× at ~17 charsF4.1: 1.03× at ~31 charsF4.1: 1.08× at ~132 charsF4.1: 1.20× at ~564 charsF4.1: 1.30× at ~2,609 charsF4.1: 1.35× at ~11,110 charsF4.1: 1.34× at ~51,046 charsF2F2: 1.01× at ~16 charsF2: 1.01× at ~30 charsF2: 1.01× at ~126 charsF2: 1.01× at ~558 charsF2: 1.01× at ~2,598 charsF2: 1.01× at ~11,094 charsF2: 1.01× at ~51,030 chars
  • F5
  • F4
  • F6
  • F4.1
  • F2
Head/base cachegrind instructions per call, by input size (log-log). Each line is one input family Nemotron proposed; points above 1× are where the "faster" code does more work.
FamilyInputsRatio range Slope base → headVerdict
F5many_empty_segmentssuspected slowdown · plan1.03× – 1.60×0.55 → 0.63slower
F4many_semicolon_segments_without_equalssuspected slowdown · plan1.02× – 1.37×0.53 → 0.57slower
F6malformed cookie header – many semicolon‑separated parts that do NOT contain "="suspected slowdown · plan1.02× – 1.37×0.53 → 0.57slower
F4.1many_semicolon_segments_with_plus_in_middlesuspected slowdown · expand:F41.02× – 1.35×0.52 → 0.56slower
F2many_well_formed_cookiesclaimed speedup · plan1.01× – 1.01×0.71 → 0.71neutral

Receipt

TargetBackendImageRun AuditAdjudication
MicroPie:App()#_parse_cookiesToken Factory Sandboxesf05e47b2-dfb5-4e4e-8bff-cb2a2dcddd6bbt-micropie#3-ae94a9$0.053$0.000

Nemotron cost on Nebius Token Factory. Backend: where the untrusted code ran. Token Factory Sandboxes (a microVM branched from a kept image, cited by its UUID). Every image is content-addressed (repo at each commit + harness), so every card re-runs from the image and seed 0. Raw data: audit.