Cache common element computations on vNode
Author: WilcoFiersCreated Aug 25, 2026Updated Sep 29, 2026
Labelsperformancetarget-size
There are a few node computations Axe-core does over and over again. Things like reading the accessible name, or the role. We should look at caching these on the virtual node to see if it helps with performance:
class AbstractVirtualNode {
// Pseudo code
get role => memoize(this, getRole(this))
get roleType => memoize(this, getRoleType(this))
get implicitRole => memoize(this, getImplicitRole(this))
get explicitRole => memoize(this, getExplicitRole(this))
get accessibleText => memoize(this, accessibleTextVirtual(this))
vNode.aria => memoize([this, arg[0]], getAriaValue(this, 'aria-' + arg[0]).value)
vNode.ariaSource => memoize([this, arg[0]], getAriaValue(this, 'aria-' + arg[0]).source)
vNode.ref => memoize([this, arg[0]], getResolvedRef(this, arg[0]))
}Source: dequelabs/axe-core