Conversation
Especially the first one is not good for performance. In ruby/prism, docs generation goes from 7s to 6.75s for me, which is about a 4% improvement (including bundler startup etc, so for pure rdoc timing it should be even better)
Documentation previewCommit: |
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused optimization preserves existing behavior covered by formatter tests.
Pull request overview
Caches reusable regular expressions in Markup::ToHtml, reducing formatter initialization overhead without changing matching behavior.
Changes:
- Caches the HTML character alias regexp as a constant.
- Uses
/oto compile the interpolated hyperlink regexp once.
File summaries
| File | Description |
|---|---|
lib/rdoc/markup/to_html.rb |
Reuses compiled regular expressions during formatter initialization. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Contributor
|
I already have benchmarks developed for my previous work - took this PR for a benchmark spin. I could not reproduce improvements in Prism, but Rails docs generation definitely improved (not only in speed, but more notably in memory allocations)
It would be lovely if this PR could be merged. |
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.
Especially the first one is not good for performance.
In ruby/prism, docs generation goes from 7s to 6.75s for me, which is about a 4% improvement (including bundler startup etc, so for pure rdoc timing it should be even better)