Lazy page index in RDoc::Store (42.7% perf improvement) - #1811
Open
skatkov wants to merge 2 commits into
Open
Conversation
Documentation previewCommit: |
skatkov
marked this pull request as ready for review
September 4, 2026 16:13
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The indexed lookup preserves existing semantics and is covered across mutation and loading paths.
Pull request overview
Adds a lazy page lookup index to improve repeated page resolution performance while preserving first-match behavior.
Changes:
- Indexes page and base names on first lookup.
- Invalidates the index when files change or load.
- Adds performance and invalidation tests.
File summaries
| File | Description |
|---|---|
lib/rdoc/store.rb |
Implements and invalidates the lazy page index. |
test/rdoc/rdoc_store_test.rb |
Tests scaling and cache invalidation. |
Review details
- Files reviewed: 2/2 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.
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.
RDoc::Store#pagepreviously scanned every known file for each page lookup, including repeated misses.This adds a lazily built hash index keyed by both
page_nameandbase_name, preserving existing first-match behavior when names collide.The index is invalidated whenever files are added, removed, or bulk-loaded. The implementation remains private to
RDoc::Storeand adds no public API or configuration.Benchmark
For testing I used latest rdoc(master) + rdoc-markdown gem. Generation was done on a rails codebase.
Total time to generate documentation decreased from 88.52s to 50.76s (42.7%).