Skip to content

perf: single-file outliers from fleet telemetry — 12.5s macro-header monster + wordlist scanned as code #3188

Closed

Description

@squid-protocol

Two file-level outliers surfaced by the v2.9.0 fleet timing telemetry (first 22 repos), both #1095-class:

  1. darwin-xnu `EXTERNAL_HEADERS/AvailabilityInternal.h` — 12.47s in ONE file, 5× the fleet's next-worst (2.25s), brushing the 15s ReDoS-failsafe ceiling. It's the notorious ~1MB machine-generated availability-macro header: enormous line count of near-identical `#define` lines. Worth profiling which rule(s) eat it — likely a preprocessor-heavy pattern with no literal gate — and whether a generated-file heuristic (repetition ratio / single-token-shape density) should route it to a cheaper lane.

  2. haiku `src/apps/mail/words` — 1.76s: an extension-less dictionary wordlist scanned as code. An aperture-filter / language-detection miss: pure word-per-line files with no code signals should be classified as data, not fed to the full rule pass.

Slow-file top-10s come free in every scan's `--splicing-speed` chart and are aggregated fleet-wide by population-analyses' `aggregate_fleet_timing.py` — re-rank after the full 739-repo batch completes.

Refs: #1095 (slow-parse outlier reassessment), #3182 (Optical Detector cost), fleet telemetry: population-analyses #13.

🤖 Generated with Claude Code

Activity

  1. added
    enhancement
    on Sep 18, 2026
  2. squid-protocol commented on Sep 19, 2026

    @squid-protocol
    OwnerAuthor

    Investigation: root causes measured, and one of the two is already fixed

    Profiled both files on this box (galaxyscope, COMMUNITY_FREE_TIER, engine at current main). The per-phase --file-speed split plus a with/without-file subtraction give a clean breakdown. The original "preprocessor-heavy rule with no literal gate" hypothesis is wrong — neither outlier is a runaway rule.

    1. darwin-xnu/EXTERNAL_HEADERS/AvailabilityInternal.h (2.64 MB, 23,426 lines)

    The cost was language detection, not a rule. For a .h collision file where ecosystem gravity couldn't lock, detection fell through to the Tier 3 lexical tie-break, which runs the full 55-rule ruleset of every .h candidate (c + objective-c) across the entire 2.64 MB — measured 1999 ms (c) + 2258 ms (objc) ≈ 4.26 s, purely to decide c-vs-objc.

    This is already eliminated on main by #3137 (the sibling-classification ecosystem-gravity vote, PR #3190, merged today). The all-.h EXTERNAL_HEADERS directory now locks gravity at "100% Local Dominance" instead of falling to the tie-break. A/B on the real neighbourhood:

    engine AvailabilityInternal.h wall detection proof
    v2.9.0 (fleet baseline) 8.29 s Heuristic Loop-Back (Consensus: objective-c) (tie-break path)
    current main (#3137) 4.11 s Ecosystem Consensus Lock (100% Local Dominance)

    (The fleet's 12.47 s vs my 8.29 s on v2.9.0 is box variance — same path.) So ~4 s of this outlier is gone as of today, incidentally.

    Residual ~4 s on main (with/without-file subtraction) is no longer detection — it's the analysis passes over the 2.64 MB machine-generated body:

    phase AvailabilityInternal.h contribution
    Security_Lens ~1.98 s
    Optical_Detector ~1.50 s
    Lexical_Scan ~0.42 s
    Language_Detector ~0.09 s (was ~4.2 s on v2.9.0)

    This residual is the real target for the generated-file fast-lane idea: 23k near-identical #define lines don't need the full security + optical rule pass. A repetition-ratio / single-token-shape gate that routes obviously-generated files to a cheaper analysis lane would take the remaining ~3.5 s (Security + Optical) off it.

    2. haiku/src/apps/mail/words (275 KB, 28,137 lines)

    Real on both v2.9.0 and main — not touched by #3137. It's an extensionless dictionary: 63%+ pure one-word-per-line, avg 8 chars/line, and zero code punctuation ({ } ; ( )) anywhere in the file. In isolation the aperture filter rejects it, but inside the real mail/ code directory it's admitted (extensionless files are, to catch configure/scripts) and then fed to the Tier 4 extensionless discovery funnel, which scans it against many languages' rulesets:

    phase cost
    Language_Detector (discovery funnel) ~1.0 s (dominant)
    Optical_Detector ~0.5 s

    Fix: a cheap data-vs-code gate ahead of the discovery funnel — near-zero code-punctuation density + high one-token-per-line ratio → classify as plaintext/data and skip the funnel + rule pass. This is the #1095-class "wordlist scanned as code" miss.

    Suggested disposition

    Re-rank both against the full 739-repo batch once it completes (the fleet numbers were v2.9.0; #3137 will have moved every .h-collision file).

  3. squid-protocol commented on Sep 19, 2026

    @squid-protocol
    OwnerAuthor

    The words half is now fixed in PR #3194 — a data-shape fast-exit in the Tier 4 discovery funnel. Measured on the real git-tracked haiku/src/apps/mail: the words file 1.207s → 0.257s and the detector phase 1.05s → 0.02s, with byte-identical classification (detection audit unchanged, golden crucible 0 diffs).

    Remaining on this issue: the AvailabilityInternal.h analysis-lane residual (~2s Security_Lens + ~1.5s Optical_Detector over the 2.6MB generated body; its detection cost was already removed by #3137). That's the generated-file fast-lane lever, a larger change — leaving it open for that.

  4. squid-protocol commented on Sep 19, 2026

    @squid-protocol
    OwnerAuthor

    Fleet context: single-file outliers are a rounding error vs the systemic cost

    Across the full 739-repo fleet, per-file outliers like these are negligible against the two real sinks (Optical Detector 61%, Security Lens 26.5% of fleet CPU; B_Braces alone 3,931s). The words half is fixed (#3194); the AvailabilityInternal.h detection cost was already removed by #3137, leaving only its analysis-lane residual (~3.5s on one file).

    Recommendation: priority: low. The generated-file fast-lane for the AvailabilityInternal.h residual is a nice-to-have; the fleet's CPU is elsewhere (see #3182). Keep open for the residual, but it shouldn't compete with the B_Braces work.

  5. added
    priority: low
    on Sep 19, 2026
  6. added
    scope:infra
    on Oct 16, 2026
  7. squid-protocol commented on Oct 18, 2026

    @squid-protocol
    OwnerAuthor

    PR #5441 fixes outlier 1 (directive-table fast lane for AvailabilityInternal.h-style headers). Outlier 2 (extension-less wordlist scanned as code, haiku src/apps/mail/words) is not addressed yet, so leaving open.

  8. added
    needs:corpus
    on Oct 18, 2026
  9. squid-protocol commented on Oct 24, 2026

    @squid-protocol
    OwnerAuthor

    Claimed by promoter-bot host melek, lease renewed 2026-10-24T04:28Z. It lapses after 6 h without a renewal. To take it back, assign someone or remove the claim:melek label.

  10. squid-protocol commented on Oct 24, 2026

    @squid-protocol
    OwnerAuthor

    Both outliers are addressed: the wordlist is fast-exited by #3194 (now pinned by tests in #6370), and the AvailabilityInternal.h cost is fixed by #3137 (detection) and #5441 (Security Lens). A ~1.3 s residual on a synthetic 2.2 MB table, spread over ~55 rules, remains. It cannot be removed without a golden-moving change to detector.py, and no burned-estate program needs it, so it is recorded as a sibling gap rather than kept open here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    claim:melekenhancementneeds:corpusperformancepriority: lowscope:infra

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions