Repository navigation
Reduce allocations when continuing a single-type GenerationCounts - #1253
Conversation
Co-authored-by: sbfnk <sebastian.funk@lshtm.ac.uk>
Co-authored-by: sbfnk <sebastian.funk@lshtm.ac.uk>
Co-authored-by: sbfnk <sebastian.funk@lshtm.ac.uk>
Benchmark comparison vs baseMinimum time per call. Buckets are PR time as a % of base, so lower is faster (🟢 faster, ⚪ within 5%, 🔴 slower). Counts of benchmarks per bucket:
Evaluation — 19 benchmarks (by time change)
AD gradients — 0 benchmarks (by time change)none |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1253 +/- ##
==========================================
+ Coverage 97.81% 97.82% +0.01%
==========================================
Files 104 104
Lines 11791 12143 +352
==========================================
+ Hits 11533 11879 +346
- Misses 258 264 +6
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Co-authored-by: sbfnk <sebastian.funk@lshtm.ac.uk>
Co-authored-by: sbfnk <sebastian.funk@lshtm.ac.uk>
|
The changelog check failed because the pull request had no fragment. I added |
Co-authored-by: sbfnk <sebastian.funk@lshtm.ac.uk>
|
Merged main. The conflict was in the single-type |
|
Relayed for @sbfnk: Yes, change the type of |
…on allocates nothing Co-authored-by: sbfnk <sebastian.funk@lshtm.ac.uk>
Co-authored-by: sbfnk <sebastian.funk@lshtm.ac.uk>
|
A single-type Measured with |
…ead of a missing method Co-authored-by: sbfnk <sebastian.funk@lshtm.ac.uk>
Co-authored-by: sbfnk <sebastian.funk@lshtm.ac.uk>
|
The JET failure came from |
Co-authored-by: sbfnk <sebastian.funk@lshtm.ac.uk>
Co-authored-by: sbfnk <sebastian.funk@lshtm.ac.uk>
Co-authored-by: sbfnk <sebastian.funk@lshtm.ac.uk>
|
The failing check was the allocation test on the full single-type state, which reported 288 bytes on Julia 1.10. It called |
|
Relayed for @sbfnk: Fix the fresh-state case in this PR too, so that it closes #1251. The issue's own example continues a fresh state with empty doses_used on every call, and that still allocates 96 bytes each time. Give a single-type state its doses as a tuple of zeros, one per campaign, before the first continuation (in prepare_generations or where the state is built), so the returned state has the same type as the one given. Add an allocation check for the first continuation of a fresh state with a MassVaccination, a GroupVaccination and no campaign, and re-run the issue's example. |
Co-authored-by: sbfnk <sebastian.funk@lshtm.ac.uk>
Co-authored-by: sbfnk <sebastian.funk@lshtm.ac.uk>
|
|
|
The documentation job timed out. The supplied log shows only cleanup, so the stall point and cause remain unconfirmed. The build did not complete. |
Continuing a single-type
GenerationCountsno longer allocates in a generation, including one that takes doses from the population, one that doses contacts, and the first continuation of a fresh state. The state holdsdoses_usedas a tuple of integers, one per campaign, andprotectedas an integer. It stays immutable, and a continuation returns a new one without a heap copy. States with several types keep a vector of vectors and a vector.prepare_generationsholds the campaigns of a single-type state as a tuple, so their number is known at compile time. A fresh single-type state built bysimulatestarts with one zero per campaign, so its first continuation returns a state of the same type. The draws are unchanged.Measured with
@allocatedon a prepared continuation, a budgetedMassVaccination, aGroupVaccination, both together, and no campaign allocate 0 bytes, including the first continuation of a fresh state. I did not re-run the thread-scaling and particle-filter timings.test/test_generation_campaigns.jlpasses with the new allocation checks, as do the other test files that read these fields.This PR closes #1251.