Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use require_relative in the Rake codebase #566

Merged
merged 1 commit into from May 10, 2024

Conversation

koic
Copy link
Contributor

@koic koic commented May 9, 2024

If there are many searches in the $LOAD_PATH in the user environment, require will perform unnecessary searches that are not needed. In contrast, require_relative is efficient because it uses a relative path.

Rake requires Ruby 2.3+, it is possible to use require_relative, which was introduced in Ruby 1.9.
https://github.com/ruby/rake/blob/v13.2.1/rake.gemspec#L99

If there are many searches in the `$LOAD_PATH` in the user environment,
require will perform unnecessary searches that are not needed.
In contrast, `require_relative` is efficient because it uses a relative path.

Rake requires Ruby 2.3+, it is possible to use `require_relative`,
which was introduced in Ruby 1.9.
https://github.com/ruby/rake/blob/v13.2.1/rake.gemspec#L99
@hsbt hsbt merged commit 1ad1a11 into ruby:master May 10, 2024
28 checks passed
@hsbt
Copy link
Member

hsbt commented May 10, 2024

Thanks!

@koic koic deleted the use_require_relative branch May 10, 2024 01:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants