← Back to Pull requests

[Perf][SwiftSyntax] Inline the BumpPtrAllocator fast path, and make it final #3472

Closed
unknown closed this pull request without merging on Oct 12, 2026 19:51 UTC
View on GitHub
unknown unknown commented on Oct 11, 2026 15:29 UTC
Author

BumpPtrAllocator and ParsingRawSyntaxArena are now final. Nothing inherits them.

BumpPtrAllocator.allocate(byteCount:alignment:), allocate(_:count:) and allocateFromCurrentSlab are now @inlinable.

Result

Against main (8453c53ae), two pairs, instructions and wall clock:

| | instructions, pair 1 / pair 2 | wall clock, pair 1 / pair 2 |
| ------------------------------------- | ----------------------------- | --------------------------- |
| parse: MinimalCollections | −3.41% / −3.40% | −2.5% / −2.7% |
| decl_heavy | −3.67% / −3.66% | −3.8% / −2.5% |
| nonascii_heavy | −3.58% / −3.58% | −3.7% / −2.3% |
| corrupt_heavy | −4.64% / −4.64% | −3.5% / −3.6% |
| text consumers: syntaxTextBytes | +0.04% / +0.00% | +1.0% / +2.2% |
| SourceLocationConverter | +0.05% / +0.04% | +1.1% / +1.6% |
| description | +0.01% / +0.03% | +3.8% / +1.5% |
| reads: typed accessors | −1.02% / −1.08% | −1.2% / −2.6% |
| rawText reads | −1.32% / −1.39% | −2.9% / −1.7% |
| empty SyntaxVisitor walk | −2.91% / −2.88% | −4.0% / −3.7% |
| children(viewMode:) walk | −1.50% / −1.47% | −3.5% / −3.9% |

I looked into text consumers (syntaxTextBytes), they are the same instructions in the asm, but still it measures slower, I _think_ it's something with the code's placement rather than the instructions.

Each change on its own, instructions:

| | final only | inlined bump only | both |
| -------------------------- | --------------- | ----------------- | ------ |
| parse MinimalCollections | −0.52% | −2.28% | −3.41% |
| parse decl_heavy | −0.52% | −2.40% | −3.67% |
| parse nonascii_heavy | −0.90% | −2.04% | −3.58% |
| parse corrupt_heavy | −2.83% | −1.47% | −4.64% |
| empty SyntaxVisitor walk | −0.06% | −2.90% | −2.91% |
| children(viewMode:) walk | +0.04% | −1.50% | −1.50% |

| code size (__text) | final only | inlined bump only | both |
| -------------------- | ------------ | ----------------- | -------------------- |
| SwiftSyntax | +112 bytes | +5,324 bytes | −1,776 bytes (−0.1%) |
| SwiftParser | −4,164 bytes | −8 bytes | −2,452 bytes (−0.4%) |

Diff: 356 lines (+267 / -89) across 4 files Reviewer: hamishknight Review duration: 1702m
All Vouch review confidence checks passed
Residual risk 0.17 = Change Risk (0.43) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.43 · 356 lines diff across 4 files
0.43
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.352
Shallow Review Depth shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #3472"
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: 42.5% (MEDIUM) · Higher = larger blast radius
42.5%
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: 16.8% · Safe to merge
16.8%