Store deduped paths in $LOADED_FEATURES #3182
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.
This is probably naive and incomplete, but I managed to get it to work and now I can share it to ask how it should be done.
I noticed that bootsnap has some tests where it assumes the items in $LOADED_FEATURES are deduplicated strings:
https://github.com/Shopify/bootsnap/blob/2ea29bed2c027d8eb6a008d78db4a46ce68d1fa4/test/load_path_cache/cache_test.rb#L173-L181
It seems to be the case in CRuby so I added a spec for it and wanted to see what it would take in TruffleRuby.
I did find some existing comments about it so it seems like something we wanted to pursue here.
I don't even know if I'm using the right terminology (deduped strings)
and this is the first time I encountered the
post-boot
stuffso I'd be glad for any feedback or direction in how to accomplish this correctly.
$LOAD_PATH
also contains frozen strings in ruby, but i didn't dig further to figure out how that might be accomplished. If you have any pointers I'd be glad to integrate that.Thanks!