← Back to Pull requests

perf(linter/jest/valid-title): compile disallowedWords regex once #24412

Closed
unknown closed this pull request without merging on Jul 12, 2026 21:08 UTC
View on GitHub
unknown unknown commented on Jul 12, 2026 19:47 UTC
Author

The disallowedWords regex in jest/valid-title (shared with vitest/valid-title) was escaped, joined, and recompiled for every test/describe title checked. This moves the compilation into from_configuration, storing a compiled Option<Regex> on the config.

Benchmark

Fixture: a generated spec.test.js containing 30,000 one-line test cases of the form

test("does thing number 12345 correctly", () => { expect(12345).toBe(12345); });

None of the titles contain a disallowed word, so the fixture measures the pure per-title overhead of the rule (the common case in a real suite); output parity on the reporting path was verified separately with a canary file whose titles do contain disallowed words.

Config: a single-rule .oxlintrc.json so nothing else contributes to the timing:

{
  "plugins": ["jest"],
  "categories": { "correctness": "off" },
  "rules": { "jest/valid-title": ["warn", { "disallowedWords": ["forbidden", "banned", "xyzzy"] }] }
}

Method: two release binaries (baseline from main, this branch), run interleaved in alternating order for 40 paired samples (plus 5 warmup runs each) with --silent, timed with time.monotonic_ns(). A parse-only config ("rules": {}) run on the same fixture showed no difference between the binaries (0.995×, t=-0.9), so the delta is attributable to the rule and not binary-layout noise.

| | mean |
|---|---|
| before | 2161.19 ms |
| after | 28.89 ms |

74.8× faster (paired t=651, 40/40 wins). The magnitude scales with title count × number of disallowed words; suites that don't set disallowedWords are unaffected (the rule already early-returns). --format=json output is byte-identical between the two binaries on the fixture and canaries.

Disclosure

This change was implemented and benchmarked with AI assistance (Claude Code), and has been reviewed by the submitter.

🤖 Generated with Claude Code

Diff: 245 lines (+183 / -62) across 3 files Reviewer: connorshea Review duration: 80m
All Vouch review confidence checks passed
Residual risk 0.15 = Change Risk (0.39) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.39 · 245 lines diff across 3 files
0.39
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
0.17
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
60%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.329
Shallow Review Depth shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #24412"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 60.5% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 38.9% (MEDIUM) · Higher = larger blast radius
38.9%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 60.5% · Lower = rushed or shallow review
60.5%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 15.3% · Safe to merge
15.3%