-
Notifications
You must be signed in to change notification settings - Fork 9.5k
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
core(trace-of-tab): remove DevTools stableSort dependency #5532
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
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.
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.
does combining the filter here gain much in performance? It doesn't feel great combined (they don't really have much to do with each other, we just happen to usually do them in pairs) so unless it buys a lot it doesn't feel worth it
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.
it was 3-pronged
was gross
2) avoid another copy of the array since we're introducing a new one here and there were recent issues with large traces hurting people
3) filter inline here was ever so mildly faster on big traces
none of them are particularly strong reasons, so if it's rubbing the wrong way I can go back
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.
I'm seeing the perf benefit of the inline filter to be substantial. I think all numbers are under 50ms even for big traces, but it's worth like a 35% speedup.``
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.
FWIW https://jsperf.com/inline-filter-vs-filter, but filter component is like 1/20th the cost of the sort
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.
ha, if you're fine on a style level with combining the two steps, @paulirish, I can be fine with it too. Testing it now I see ~5% improvement over all of
_compute()
for a 31MB verge trace (~138ms -> ~131). I was just questioning this part from a code-semantics perspective.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.
(it's likely not better than 5% because the
filteredStableSort
call goes polymorphic with the second call to it in_compute()
, while AIUI as of Node 10[].filter()
specializes at the callsite, not within.This may get worse as more calls are made, e.g. if someone is running the node module in a loop. You can kind of simulate this by disabling the computed artifact cache and letting
trace-of-tab
run as many times as requested in a-G
run (110 times!). In that case the new method is a little slower (by ~5.3±4ms)All of this is dependent on inlining decisions, though, and how lighthouse itself is run, so perf seems fine either way)
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.
hot chart!
(yeah the code style doesn't bother me too much)