← Back to Pull requests

avoid a few `getindex` allocations inside the compiler #60977

Closed
unknown closed this pull request without merging on Sep 07, 2026 15:11 UTC
View on GitHub
unknown unknown commented on Feb 09, 2026 21:34 UTC
Author

in the service of https://github.com/JuliaLang/julia/issues/60802 I guess a few allocating getindex slices can be turned into iterators

minor benchmark on sum(::Vector{Int}), probably better to try a whole package load time as a target though

using BenchmarkTools

world = Base.get_world_counter()
tt = Base.signature_type(sum, (Vector{Int},))
tt = Base.to_tuple_type(tt)

interp = Core.Compiler.NativeInterpreter(world)
matches = Core.Compiler._findall_matches(interp, tt)
match = matches.matches[1]::Core.MethodMatch

@benchmark Core.Compiler.typeinf_code($interp, $match, true)

# master
BenchmarkTools.Trial: 10000 samples with 1 evaluation per sample.
 Range (min … max):  134.042 μs …  13.477 ms  ┊ GC (min … max): 0.00% … 0.00%
 Time  (median):     138.000 μs               ┊ GC (median):    0.00%
 Time  (mean ± σ):   163.802 μs ± 250.560 μs  ┊ GC (mean ± σ):  3.77% ± 6.19%

  █▅▃▂▁▂▁▁▁                                                     ▁
  ██████████████▇▇▆▇▇▆▆▅▆▅▄▅▄▅▅▅▄▅▄▃▄▃▅▅▁▄▅▃▃▁▃▃▃▃▃▃▁▃▃▄▃▁▁▁▃▁▄ █
  134 μs        Histogram: log(frequency) by time        634 μs <

 Memory estimate: 137.03 KiB, allocs estimate: 2226.



# pr
julia> @benchmark Core.Compiler.typeinf_code($interp, $match, true)
BenchmarkTools.Trial: 10000 samples with 1 evaluation per sample.
 Range (min … max):  111.167 μs …  3.757 ms  ┊ GC (min … max): 0.00% … 95.18%
 Time  (median):     113.917 μs              ┊ GC (median):    0.00%
 Time  (mean ± σ):   119.561 μs ± 78.087 μs  ┊ GC (mean ± σ):  3.72% ±  6.09%

    ▁██▆▃                                                       
  ▂▄██████▆▅▄▃▃▃▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▁▂▂▂▂▂▂▂▂▂▂▂▂▂▂ ▃
  111 μs          Histogram: frequency by time          143 μs <

 Memory estimate: 135.64 KiB, allocs estimate: 2223.

Diff: 227 lines (+170 / -57) across 2 files Reviewer: nsajko Review duration: 302017m
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 · 227 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.325
Shallow Review Depth shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #60977"
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: 36.9% (MEDIUM) · Higher = larger blast radius
36.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: 14.6% · Safe to merge
14.6%