Repository navigation
Reuse grapheme offsets to speed up word motions - #5
Merged
Merged
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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.
Word scans recompute the same grapheme boundary two or three times when advancing through a word. Reuse that offset in backward scans and forward word-end scans to reduce work for
b,e, and the related motions and operators that share this implementation.The first commit adds a standalone benchmark for
w,b,e,iw, andawat counts 1, 10, and 100, using both string and Ropey text sources. It samples valid grapheme boundaries and provides exact-output verification. The second commit applies the optimization.Measured on macOS arm64 with Rust 1.99.1 release builds. Each cell below is a geometric mean across fixtures of the median of three paired baseline/candidate runtime ratios. Higher is faster.
How to test
Compare the first commit (benchmark baseline) with the second commit using the same toolchain and machine.
Expect lower time per operation for backward-word and forward-word-end scans. Compare the verification stdout from both revisions byte for byte, including the holdout run covering CRLF, combining marks, emoji sequences, and EOF.
All 36,600 resolver observations matched the baseline. Rust tests passed with default features and Ropey. The local conformance run passed 393/393 cases on installed Neovim 0.12.2 with its version assertion adjusted in memory. The existing reference CI job runs the repository's pinned Neovim 0.12.1.