Skip to content

Use require_relative in the Racc codebase#269

Merged
flavorjones merged 1 commit intoruby:masterfrom
koic:use_require_relative
Jun 5, 2024
Merged

Use require_relative in the Racc codebase#269
flavorjones merged 1 commit intoruby:masterfrom
koic:use_require_relative

Conversation

@koic
Copy link
Contributor

@koic koic commented Jun 5, 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.

Racc requires Ruby 2.5+, it is possible to use require_relative, which was introduced in Ruby 1.9.
https://github.com/ruby/racc/blob/v1.8.0/racc.gemspec#L44

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.

Racc requires Ruby 2.5+, it is possible to use `require_relative`,
which was introduced in Ruby 1.9.
https://github.com/ruby/racc/blob/v1.8.0/racc.gemspec#L44
@flavorjones flavorjones merged commit 489ddae into ruby:master Jun 5, 2024
@koic koic deleted the use_require_relative branch June 5, 2024 20:32
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.

2 participants