Skip to content

Optimize $LOADED_FEATURES.include?#1

Open
palkan wants to merge 1 commit into
masterfrom
feat/opt-loaded-features-include
Open

Optimize $LOADED_FEATURES.include?#1
palkan wants to merge 1 commit into
masterfrom
feat/opt-loaded-features-include

Conversation

@palkan
Copy link
Copy Markdown
Owner

@palkan palkan commented Apr 21, 2026

Summary

This PR makes maintaining and manipulating the loaded features state from the user space (Ruby, not C) more efficient (=not slow at scale) by optimizing a couple of methods:

  • Optimize $LOADED_FEATURES.include?(feature): use rb_provided check instead of relying on Array#include? to speed up the feature entry check for very big $LOADED_FEATURES

  • Improve$LOADED_FEATURES.<<(feature): use rb_provide_feature, so no index rebuilding required when manually maintaining the loaded features index

Use rb_provided check instead of Array#include? to speed up the check for large $LOADED_FEATURES

Also adds #<< to use rb_provide_feature, so no index rebuilding required when manually maintaining the loaded features index
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant