Avoid memory allocation on quicklist iteration#14720
Merged
skaslev merged 2 commits intoredis:unstablefrom Jan 21, 2026
Merged
Conversation
🤖 Augment PR SummarySummary: This PR removes heap allocation from quicklist iteration by switching to stack-allocated iterators throughout the quicklist API. Changes:
Technical Notes: The iterator “cleanup” path still recompresses the current node to preserve quicklist compression semantics, but no longer performs allocator work for iterator creation/destruction. 🤖 Was this summary useful? React with 👍 or 👎 |
fcostaoliveira
pushed a commit
to filipecosta90/redis
that referenced
this pull request
Jan 21, 2026
This change is the last in the series (see redis#14200 and redis#14473) where we store iterators on the stack rather than allocating them the heap.
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.
This change is the last in the series (see #14200 and #14473) where we store iterators
on the stack rather than allocating them the heap.
Note
Shifts quicklist iteration to a stack-based API to avoid per-iteration heap allocations.
quicklistGetIterator*withquicklistInitIterator*andquicklistReleaseIteratorwithquicklistResetIterator;quicklistInitIteratorAtIdx()/quicklistInitIteratorEntryAtIdx()now return 1/0 instead of pointersquicklist.ctests/benchmarks,t_list.c, andserver.h(listTypeIteratornow embedsquicklistIterinstead of a pointer)quicklistNextassumes a valid iterator)Written by Cursor Bugbot for commit ea17980. This will update automatically on new commits. Configure here.