Use fast_step in DPMux for non-current-rank items + add tests#47
Merged
Randomizez merged 2 commits intoApr 19, 2026
Merged
Conversation
Cover basic rank selection, state save/restore, fast_step parity with __next__, len delegation, input validation, and iter protocol. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Avoid unnecessary data loading for items belonging to other ranks by calling fast_step() (state advance only) instead of next() (state advance + I/O). With dp_size=N, this skips N-1 data loads per step. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Randomizez
approved these changes
Apr 19, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
DPMux.__next__was callingnext()for all ranks, loading data that gets discarded for non-current-rank items. Changed to usefast_step()for other ranks — skips N-1 data loads per step.DPMuxand nextable interfaces (previously uncovered).Discussion
Is
fast_step()sufficient to fully advance state?next()may carry side effects beyond whatfast_step()/update()captures — if anySlowFastNextableimplementation mutates state inside the slow path thatfast_step()doesn't replicate, skippingnext()for non-current-rank items could cause state divergence. However, if we must callnext()to keep state correct, then we're forced to do the expensive work for every rank — which defeats the entire purpose of theSlowFastNextableseparation.Test plan
pytest tests/test_nextable.py— 11/11 passed🤖 Generated with Claude Code