Repository navigation
Cut substitute_v allocations without changing integrand point types - #383
ChrisRackauckas merged 2 commits into
Conversation
Leading Base.map with Vector domain bounds forced a Vector of transformed points on every HCubatureJL evaluation; ordering the map by the SVector point removes those allocations and matches what HCubature passes directly. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Cursor Agent <noreply@cursor.com> Agent-Harness: Cursor Agent 2026.10.01-14929f9 Agent-Model: unknown (Cursor auto) Agent-Session: local session, transcript /home/crackauc/sandbox/goals/performance/jobs/integrals/int-substv/log.txt on amdci2
Map via immutable evaluation points (HCubature SVectors) then copy once into similar(lb) so Vector domains still pass Vector to the integrand, matching the ded0128 container-type contract with ~half the allocations. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Cursor Agent <noreply@cursor.com> Agent-Harness: Cursor Agent 2026.10.01-14929f9 Agent-Model: unknown (Cursor auto) Agent-Session: local session, transcript /home/crackauc/sandbox/goals/performance/jobs/integrals/int-substv/log.txt on amdci2
Independent review (Devin CLI 3000.11.3, model fusion-claude-opus-5-5-high-sidekick-swe-2-medium): MERGE, risk low. Full reviewVERDICT: MERGE Blocking findingsNone. Non-blocking findings
What I ranAll runs used Julia 1.11.9, with scratch environments that
What I did not verify
🤖 Posted by an AI agent — harness: Devin CLI 3000.11.3 (review), Claude Code 2.1.285 (posting) · model: fusion-claude-opus-5-5-high-sidekick-swe-2-medium |
Agent-Harness: Devin CLI 3000.11.3 Agent-Model: Fusion (Claude Opus 5.5 Medium + SWE-2 Medium) Agent-Session: local transcript ~/.local/share/devin/cli/transcripts/flash-hour.json Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Summary
For Vector domains, HCubature evaluates at immutable
SVectorpoints whilesubstitute_vhistorically mapped with the Vector bounds first, allocating a Vector of intermediates on every evaluation. This PR maps via the evaluation point when it is immutable, then copies once intosimilar(lb)so the integrand still receives the domain container type (Vector for Vector domains, SVector for SVector domains)—preserving the deliberate design from ded0128.This is a non-breaking rework of the earlier draft that returned
SVectorpoints for Vector domains.What a reviewer should push back on
similar(lb)per evaluation remains (3-D Vector ~19k allocs vs ~66 for the breaking approach). A type-stable reused buffer was tried viaRef{Any}and regressed badly; a typed buffer reuse may still be possible.ArrayInterface.ismutableis the right gate for “domain container kind” (e.g. unusualAbstractVectorsubtypes).Verification
Regression (domain container type +
x .^ 2Vector output)x isa Vectorfailed;x .^ 2TypeError). See jobbefore.txt.after.txt.Benchmarks (
JULIA_NUM_THREADS=1 taskset -c 23,@benchmarkminima)Reviewer probes (
orch/reviews/pr-383/round1/)substv_probe.jl: 221 rows, 0 type/error diffs vs master (11 algorithms × domains × oop/iip/batch).substv_break.jl: matches master (Vector-typed integrands,setindex!,push!,x .^ 2→Vector{Float64}; HAdaptive iip still unsupported as on master).Test-group tails
GROUP=Core(Julia 1.12.4):GROUP=QA:Runic + typos clean on changed files.
What I did NOT verify
Please ignore until reviewed by @ChrisRackauckas.
Risk assessment
ChangeOfVariables(transformation_if_inf, …); benefit concentrated on HCubatureJL + Vector domains.🤖 Generated with Cursor Agent 2026.10.01-14929f9 (model: unknown (Cursor auto)), transcript /home/crackauc/sandbox/goals/performance/jobs/integrals/int-substv/log.txt on amdci2; orchestrated by Claude Code (claude-opus-5-5[1m]) https://claude.ai/code/session_01LPHREnnonfLg1VcE1EJovv
Independent review: Devin Fusion (fusion-claude-opus-5-5-high-sidekick-swe-2-medium) rated it low, verdict MERGE: #383 (comment)