← Back to Pull requests

abstractarray: Inline `_cat` and `__cat` so small `cat` calls stay specialized #64849

Closed
unknown closed this pull request without merging on Nov 11, 2026 14:33 UTC
View on GitHub
unknown unknown commented on Nov 10, 2026 21:27 UTC
Author

A _cat(dims, X...) call that is not inlined is compiled as _cat(::Val{1}, ::Vector{T}, ::Vararg{Any}), which dispatches dynamically and is invalidated by any package adding size, promote_rule, Colon or tail methods. #64582 moved vcat(::Vector{T}, ::T) over the inlining threshold for non-inline element types, and since create_expr_cache used such a vcat, about 170 method instances of the loading code got invalidated by many packages (+3.2k invalidations in the TTFX run). This marks _cat and __cat @inline, so a two-argument call always reaches __cat_offset! with concrete types, and avoids vcat in create_expr_cache.

| | before #64582 | master | PR |
|---|---:|---:|---:|
| invalidated by using ForwardDiff | 117 | 280 | 117 |
| invalidated by using Unitful | 45 | 208 | 45 |
| vcat(::Vector{String}, ::String) | 17 ns | 285 ns | 18 ns |
| vcat(::Vector{Int}, ::Int) | 312 ns | 17 ns | 19 ns |
| first vcat(xs...) of 100 mixed scalars and vectors | | 49–84 ms | 75–87 ms |

The same-eltype method _cat(catdims, A::AbstractArray{T}...) is marked @inline as well. It was not inlined either (also on 1.12–1.14), so cat(A, B; dims=3) called an instance compiled for _cat(::Int, ::Matrix{T}, ::Vararg{Matrix{T}}), which knows neither the constant dims nor the number of arrays. vcat/hcat of same-eltype arrays were already inlined and are unchanged.

| 2×2 Matrix{Int} | master | PR |
|---|---:|---:|
| cat(A, B; dims=3) | 370 ns | 23 ns |
| cat(A, B; dims=Val(3)) | 412 ns | 27 ns |
| cat(A, B; dims=(1,2)) | 389 ns | 28 ns |
| cat(A, B, C; dims=3) | 569 ns | 159 ns |
| cat(A, B; dims=d), runtime d | 582 ns | 275 ns |

🤖 Generated with Claude Code

Diff: 234 lines (+175 / -59) across 2 files Reviewer: adienes Review duration: 1025m
All Vouch review confidence checks passed
Residual risk 0.15 = Change Risk (0.37) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.37 · 234 lines diff across 2 files
0.37
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.327
Shallow Review Depth shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #64849"
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: 37.1% (MEDIUM) · Higher = larger blast radius
37.1%
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: 14.7% · Safe to merge
14.7%