-
-
Notifications
You must be signed in to change notification settings - Fork 47
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
Optimizing role computation and selector matching #1049
Comments
Thank you for your proposal. The current cache strategy needs to be more mature. |
I am facing the same issue. The file I am encountering the issue with is located here. I have investigated how the execution time scales with the number of option elements as additional information. |
There are some cases where markuplint is slow, especially when a file contains hundreds of nodes. It takes a few seconds to lint a single HTML file on my machine.
Although the bottlenecks can vary depending on the DOM structure, enabled rules, and configuration, I have identified two functionalities that can be sped up with little effort:
Role computation
Role computation is a compute-intensive process, and the same inputs always produce the same output (role). Caching the results can boost the performance of a few linting rules, including require-accessible-name.
Selector matching
A simple selector will never match if one or more parts of the selector don't match.
For example,
input[type=button]
will never matchbutton[type=button]
becauseinput
doesn't matchbutton
. Hence, we can skip the[type=button]
matching.Since these optimizations should not change the results, I'm not planning to add new tests and would like to check if the existing tests have passed. If this is acceptable, I can open the pull requests.
The text was updated successfully, but these errors were encountered: