Speed up LoadPathCache with more C #278
Closed
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.
I decided to keep up the momentum with #277 and create a tenative pull request with my proposed changes to load path cache.
This includes:
Dir.glob
. It is both faster and easier on memory - unlikeDir.glob
creating a large array and then iterating it, it yields with every found path and does path exclusion on C level.I tested those changes against Discourse, but without significant speedup:
However, with my internal project with a lot of javascript (webpacker etc.), caching etc. savings are significant:
Legend:
rm tmp/cache/bootsnap-load-path-cache
)I'm not the best C programmer (or even mediocre one), so to use this new C extension one must set environment variable
BOOTSNAP_EXPERIMENTAL
. This way people with project in dire need to speed up can experimentally use this, while most of the people can safely use existing version.Let me know what you think about this direction.