You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Improve sortedcontainers iterators speed. ALL sortedcontainers call SortedList.__iter__() internally, hence this change will apply to all of them.
for a code equivalent to tuple(iter(SortedList(range(n)))), here are the new numbers with this PR.
size is the nb of items in the Iterator and the number below each library is the median duration in microseconds to complete the task.
size
relative
10
2.123
100
1.66
1000
1.442
10000
1.3665
100000
1.344
With reversed iterator:
size
relative
10
2.192
100
1.473
1000
1.3555
10000
1.4155
100000
1.279
Other changes
a full revamp of benchmark CLI for much more convenient runs and analysis
CI checks jobs on github are now much faster with cache use and reduction of redundant work
deduplicated a lot of code
In general for sortedcontainers, less pointers indirection since we don't need Arc anymore as much
AI policy guidelines
Architecture documentation
NOTE:
tried to use copilot review. Can catch some useful issues but lot of false positives on polars behavior, and overall greptile is much better. I don't have any money to spend for that left anyway lmao.
- split `sorted_rs::Iter` in 4 different structs, but no longer generic
- add corresponding pyclasses
- centralise iterators construction with a command enum
- only use Atomics on necessary fields
Exhausted iterators resume after collection mutation
crates/sorted_rs/src/iter/core.rs:57
Both forward and reverse null-return paths leave the cursor unchanged, so collection mutations can revive an exhausted iterator. For example, exhaust iter(SortedList([1])) through StopIteration, then add 2: the next call yields 2. Likewise, create a reverse iterator, clear its collection, observe StopIteration, then repopulate it: iteration resumes. Python iterators must stay exhausted. Record a permanent terminal state in both paths, and test mutation after StopIteration; additions before the first exhaustion check should still work.
Cache reuses failure index after command changes
scripts/checks.py:53
The cache stores only a failed index, so changing --slow does not reset it as promised by the CLI help. For example, a fast-mode failure at index 3 is reused by the nine-command slow run because 3 < 9, skipping the earlier checks. Adding or reordering commands can also reuse the wrong index. Store a command-list signature alongside the index and restart at zero when the signature changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Main goal
Improve sortedcontainers iterators speed. ALL sortedcontainers call
SortedList.__iter__()internally, hence this change will apply to all of them.for a code equivalent to
tuple(iter(SortedList(range(n)))), here are the new numbers with this PR.sizeis the nb of items in theIteratorand the number below each library is the median duration in microseconds to complete the task.With reversed iterator:
Other changes
NOTE:
tried to use copilot review. Can catch some useful issues but lot of false positives on polars behavior, and overall greptile is much better. I don't have any money to spend for that left anyway lmao.