-
-
Notifications
You must be signed in to change notification settings - Fork 153
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
Significantly optimize parsing overhead when --since
is specified
#1382
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -120,13 +120,22 @@ def subject_config(node) | |
def matched_view | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mbj there is something wrong or incomplete with mutant or the zombification process. When I tried to mutate Mutant::Matcher::Method it found zero subjects. I had the same behavior on master as well so it was not introduced by this change. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Works perfectly for me on main. Can you share a reproducing CLI? |
||
return if source_location.nil? | ||
|
||
# This is a performance optimization when using --since to avoid the cost of parsing | ||
# every source file that could possibly map to a subject. A more fine-grained filtering | ||
# takes places later in the process. | ||
return unless relevant_source_file? | ||
|
||
ast | ||
.on_line(source_line) | ||
.select { |view| view.node.type.eql?(self.class::MATCH_NODE_TYPE) && match?(view.node) } | ||
.last | ||
end | ||
memoize :matched_view | ||
|
||
def relevant_source_file? | ||
env.config.matcher.diffs.all? { |diff| diff.touches_path?(source_path) } | ||
end | ||
|
||
def visibility | ||
# This can be cleaned up once we are on >ruby-3.0 | ||
# Method#{public,private,protected}? exists there. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dgollahon I could get a rid of the entire
subject_filters
after checking private integrations, they where ported to the hooks subsystem so no need to maintain this API. this overall makes this commit much nicer than previous versions.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! Thank you for validating and simplifying that. I think it's much nicer code-wise, just didn't realize it was an option.