Repository navigation
Convert hotpath optimizations - #75
Merged
Merged
Conversation
Feed the parser with one-shot UTF-8 input, trim markdown buffers in place, and tighten escape/merge/code scanning to cut Wikipedia convert latency by about 3% on the convert_bench harness.
Replace wip placeholders from the convert hot-path optimization session.
Use the join_blocks newline-count idiom instead of byte-scan helpers, name the markdown buffer capacity hint, clarify pre-escape marker decisions, and scan inline-code backticks with a plain enumerate loop.
String::new() is within noise of with_capacity(4096) on convert_bench, so keep the simpler allocation.
Contributor
📝 WalkthroughWalkthroughThe PR refactors Markdown text processing, parent-tag selector handling, HTML parsing, and output trimming to use slices, byte scans, and in-place string operations. ChangesString and parsing allocation cleanup
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Use char::is_ascii_digit instead of a manual '0'..='9' match.
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.
The optimizations from AI show a 3.9% improvement in the benchmark result:
15.401ms -> 14.794ms
Summary by CodeRabbit
Performance
Compatibility
Refactor