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

color-contrast takes >200s #1985

Closed
connorjclark opened this issue Jan 14, 2020 · 4 comments
Closed

color-contrast takes >200s #1985

connorjclark opened this issue Jan 14, 2020 · 4 comments
Assignees
Labels
color contrast Color contrast issues performance Performance related issues

Comments

@connorjclark
Copy link
Contributor

connorjclark commented Jan 14, 2020

URL: https://james-muriithi.github.io/jCheckBox/

Expectation: color-contrast should finish in ~2s (duration of the second-longest check for the same page).

Actual: ~230s

Motivation: Prevent Lighthouse run from failing to finish.

See: GoogleChrome/lighthouse#10183 (comment)

axe-core version: 3.3.0
Chrome 79

Previous issues: #716


image

image

Profile-20200114T124246.json.zip

@straker
Copy link
Contributor

straker commented Jan 14, 2020

Thanks for reporting this. We're actually working on a huge improvement to the color-contrast rule right now. I tested the page using the new code and it can run color-contrast in 10 seconds. That's a bit slower than running it on a page with 50k+ nodes, so I'll do some digging to see if I can boost the performance some more.

@straker straker added color contrast Color contrast issues performance Performance related issues labels Jan 14, 2020
@connorjclark
Copy link
Contributor Author

Super great! Thanks for the quick response :)

@straker
Copy link
Contributor

straker commented Jan 27, 2020

Alright, I dug into the problem and it turns out that issue is the large syntax highlighted code blocks. When we do color contrast, we look at the clientRects of an element and find each element stack for each rect.

Well it turns out that the large code block has 1981 client rects and so we take a very long time to process this. Even in the latest code it takes 7 seconds to loop over each rect and get all the elements in the stacks. The other code blocks have between 26 and 90 client rects.

We should probably find some way to filter out elements like these since they don't need to be checked for color contrast, just their children.

@padmavemulapati
Copy link

I am seeing , the time taking is between 1.6 to 1.74 secs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
color contrast Color contrast issues performance Performance related issues
Projects
None yet
Development

No branches or pull requests

4 participants