Avoid re-rendering readmes#461
Closed
BenjaminSchaaf wants to merge 1 commit into
Closed
Conversation
The readme rendering is slow and memory intensive, but there's no reason to redo all that work every time. We now store a hash of the text used to render the readme inside readmes_renderes.json to avoid re-rendering.
BenjaminSchaaf
force-pushed
the
cache-readme-rendering
branch
from
July 21, 2026 08:09
19d1131 to
de36083
Compare
Collaborator
|
Cherry-picked. The main problem with this commit was that it only considered the source text to invalidate the cache, but the other side, the renderer, can also change. Also the root cause should be fixed as we really run out-of-memory here quickly. With the root fix applied, the question was if we should cache at all as caches can become stale but I still went with it as it really seems natural to do so. The follow-up is #462 |
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 readme rendering is slow and memory intensive, but there's no reason to redo all that work every time. We now store a hash of the text used to render the readme inside readmes_renderes.json to avoid re-rendering.
When no readme has changed this bring rendering time from ~30s to ~700ms and of course significant memory savings.
FWIW I did a quick and dirty rewrite in rust and a full uncached render takes just 2s and ~50MB of RAM.