Skip to content

Conversation

koic
Copy link
Collaborator

@koic koic commented Mar 17, 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.

Parser gem requires Ruby 2.0+, it is possible to use require_relative, which was introduced in Ruby 1.9.
https://github.com/whitequark/parser/blob/v3.3.0.5/parser.gemspec#L27

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.

Parser gem requires Ruby 2.0+, it is possible to use `require_relative`,
which was introduced in Ruby 1.9.
https://github.com/whitequark/parser/blob/v3.3.0.5/parser.gemspec#L27
@iliabylich iliabylich merged commit 503cf61 into whitequark:master Mar 17, 2024
@iliabylich
Copy link
Collaborator

Thanks!

@koic koic deleted the use_require_relative branch March 17, 2024 17:30
koic added a commit to koic/ast that referenced this pull request May 5, 2024
iliabylich pushed a commit to whitequark/ast that referenced this pull request May 5, 2024
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