Repository navigation
perf(list): keep the nearest destinations in one bounded buffer per cursor - #231
Merged
Merged
Conversation
…ursor The nearby list change and swap cursors collected every reachable destination of a source position into a fresh vector, sorted and truncated it to max_nearby, then copied the survivors into a second destination list. Every source position paid for an allocation that grew with the whole solution, and on the zero-regression gate a quarter of nearby_change's branch misses sat in malloc, realloc, memmove and free. Each cursor now owns a BoundedNearbyCandidates buffer that keeps only the max_nearby nearest destinations offered so far, in ascending distance with offer order between equal distances. That is exactly the set and order the stable sort and truncation produced, so candidate streams are unchanged. The buffer is reused across source positions and moves read from it directly, with no second copy. Closes #228
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.
Closes #228. Nearby list change/swap cursors keep the max_nearby nearest destinations in one reused bounded buffer instead of collecting, sorting and copying every reachable destination per source. Candidate order is unchanged (tested against a stable sort for every length up to 95 and every limit). Local
make ci-local: 1723 passed, 0 failed.