dequelabs / axe-core

Accessibility engine for automated Web UI testing
https://www.deque.com/axe/
Mozilla Public License 2.0
6.03k stars 784 forks source link

Investigate memoizing getRole #3170

Open straker opened 3 years ago

straker commented 3 years ago

We should do a performance audit on axe.commons.aria.getRole and see if we should memoize it. It's used heavily throughout the code and there are potential places where it can be called on the same element multiple times (and hundreds of times in some cases).

For example, in https://github.com/dequelabs/axe-core/pull/3160 we need to look at the role of the parent table element of every row. On a site like https://web.archive.org/web/20190613132353/https://giveawaylisting.com/, that's hundreds to thousands of times the getRole function is called on the same element.

LudwikJaniuk commented 3 years ago

Looks interesting... following. (I've been thinking if there are other things that could be memoized... perhaps involving links being repeated over a page?)