Repository navigation
Suggest require paths on LoadError - #143
Merged
Merged
Conversation
yuki24
force-pushed
the
require-path-checker
branch
4 times, most recently
from
May 3, 2020 04:01
1ac5151 to
875447b
Compare
yuki24
force-pushed
the
require-path-checker
branch
from
May 9, 2020 03:04
875447b to
6246019
Compare
4 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In response to https://bugs.ruby-lang.org/issues/16824, I'm adding a "did you mean?" to the
LoadError. Here is an example of how it looks like:Performance
Finding suggestions on a large app could negatively impact the performance of the
LoadError#message. On a 8-year old Rails app, there are 12676 requirable files:And there is a benchmark:
So it would take roughly 13ms for e.g.
require 'open_struct'and 3.81ms for e.g.net/htt. The performance difference comes with the fact that DYM uses the tree spell checker (generally more accurate and faster for path names) if possible, but falls back to the traditional spell checker. I don't think this is a bad start.There is another concern in finding requirable files being a bottleneck due to disk I/O in
Dir.glob. There is room for improvement, but for now let's leave it there.Todos