Repository navigation
remote: use deques for the RPC call queues, fixes #10450 - #10457
Merged
ThomasWaldmann merged 1 commit intoSep 28, 2026
Merged
Conversation
RemoteRepository.call_many took the next call from the front of a list (calls.pop(0), self.preload_ids.pop(0)), which moves all the remaining entries each time. For a single item with millions of chunks (preload + get_many over all of its chunk ids), that made extract from a remote repository quadratic in the chunk count of the item. Use collections.deque with popleft() for calls, waiting_for and preload_ids. Backport of borgbackup#10454. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Backport of #10454 to 1.2-maint, fixes #10450.
RemoteRepository.call_manytook the next call from the front of a list (calls.pop(0),self.preload_ids.pop(0)), which moves all remaining entries each time. For a single item with millions of chunks, extract from a remote repository was therefore quadratic in its chunk count. This PR usescollections.dequewithpopleft()forcalls,waiting_forandpreload_ids.The change is the same as in #10454. It was applied by hand because
call_manyis indented differently on 1.2-maint.Measurements
Measured on a Ryzen 5 8500GE (Zen 4), Python 3.13. The repo was created with borg 1.2 (
repokey-blake2, lz4) and holds one stdin item of 1 M unique 4 KiB chunks (fixed,4096). The command isborg extract --stdout ::a big, fromssh://__testsuite__/...for the remote case.See #10454 for the full scaling series on 1.4-maint (same code, same behaviour).
Tests
pytest src/borg/testsuite/remote.py src/borg/testsuite/archiver.py -k "Remote or remote": 226 passed, 22 skipped.🤖 Generated with Claude Code