Repository navigation
Improve deleteat!(x,::Integer) - #117
Conversation
We only need to remove one element from a ChainedVector and can therefore special case the fact that if this element is a single entry in a chunk the chunk can be removed completely. This reliefs us from the slow `cleanup!()` call.
quinnj
left a comment
There was a problem hiding this comment.
[Reviewed by AI] Reviewed f229bc0caaeda22bfbea9a5f9605b01c69e14cbc. No actionable findings. The full suite and 10,024 focused deletion checks against Base passed locally on Julia 1.13/macOS arm64, including empty input chunks, singleton boundaries, custom indices, pop!, and popfirst!.
Compatibility note: dropping a singleton chunk leaves an external reference to that backing vector unchanged; the logical ChainedVector result remains correct.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #117 +/- ##
==========================================
+ Coverage 94.82% 95.65% +0.82%
==========================================
Files 5 5
Lines 1043 1058 +15
==========================================
+ Hits 989 1012 +23
+ Misses 54 46 -8 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
quinnj
left a comment
There was a problem hiding this comment.
Reviewed 01b29a6db7d645902896b56cb6187bfde67b97ad and its clean local integration with current main 7752d36a6457e82d649032bf5895cc54fa72bd8a. No actionable findings in the change. The complete suite passes on Julia 1.12.6/macOS arm64, and 18,318 deterministic deletion checks agree with Vector for integer, unsigned, and ChainedVectorIndex positions, empty input chunks, and singleton boundaries.
Five warmed samples confirm the performance gain for draining 20,000 five-element chunks: pop! median 0.8091 s to 0.003950 s (205x); popfirst! 1.050 s to 0.1339 s (7.84x). Single-chunk and singleton-chunk cases also improve. Both revisions allocate 448 bytes per measured drain.
Compatibility note: removing a singleton detaches its backing vector without emptying it, so an external reference keeps its value. The logical ChainedVector result is correct.
The extra checks also found an existing empty resize failure on unchanged main; I have isolated it for a separate fix.
AI disclosure: This work was prepared with assistance from OpenAI Codex.
We only need to remove one element from a ChainedVector and can therefore special case the fact that if this element is a single entry in a chunk the chunk can be removed completely. This reliefs us from the slow
cleanup!()call.As a result dependent functions performance improve:
pop!()with many chunkspopfirst!()with many chunkspopfirst!()with single chunk