-
Notifications
You must be signed in to change notification settings - Fork 785
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
feat(color-contrast): greatly improve performance for very large sites #1943
Merged
Conversation
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
WilcoFiers
previously requested changes
Dec 20, 2019
WilcoFiers
previously approved these changes
Jan 8, 2020
WilcoFiers
approved these changes
Jan 8, 2020
This was referenced Jan 14, 2020
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.
Remove the scroll requirement from color-contrast and use the new performance api of
dom.getElementStack
(#1842). I also tried to milk the performance of thedom.getElementStack
api for all it's worth (usingTreeWalker
, caching lookups, etc.), but I think it's the best I can get it. Lastly, to get correct color contrast, I needed every node on the page to be part of the 2d grid, even if they weren't in the axe context. So I had to create temporary VirtualNodes for any node that was missing from the virtual tree so I could use them in the stack.This returns my favorite site https://web.archive.org/web/20190613132353/https://giveawaylisting.com/ in about 5s. Slower than I wanted but way better than never returning. All other sites seem to return in about the same time as the old code.
Looking at the flame chart, you can see that the initial setting up of the 2d grid takes 2s, and then it's very tiny stacks for each of the 50906 nodes. So nothing is taking too long to run, it's just processing that many nodes is the bottleneck and something that probably can't be overcome.
For #1685, the performance went from 23s to just a few seconds to run color-contrast (had to use an archived view again https://web.archive.org/web/20180625151005/https://users.math.msu.edu/users/wongwwy/expository/torsion.html).
Closes issue: #1588, #318, #1358, #1920, #1730, #1685, #1539, #1951
Reviewer checks
Required fields, to be filled out by PR reviewer(s)