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 Parser codebase #1003

Merged
merged 1 commit into from Mar 17, 2024

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
9 checks passed
@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.

None yet

2 participants