Description
Product
axe-core
Product Version
4.8.2
Latest Version
- I have tested the issue with the latest version of the product
Issue Description
Expectation
I would expect runtime performance to correspond at most linearly to the number of DOM nodes present.
Actual
Performance appears to degrade more than linearly with the number of DOM nodes in play. That is: if I double the number of DOM nodes, performance gets ~8x worse, whereas I would expect it to at most get 2x slower.
How to Reproduce
https://github.com/nwalters512/axe-core-performance-repro
Run yarn
to install dependencies, then run node index.js
. With OPTION_COUNT = 500
, Axe runs in ~11 seconds. When OPTION_COUNT
is doubled to 1000, runtime increases to 90 seconds
Additional context
Running this code with the Node performance profiler, I was able to identify that the vast majority of time is spent in processAggregate
, and specifically in trimElementSpec
inside that. I wasn't able to dig significantly deeper than that, though it appears as though getNthChildString
is the slowest thing that runs as part of trimElementSpec
. Here's some more detail from the profiler:
