The cached reference to a DOM node
is always the fastest possible way. So once you have a reference stored, it makes no difference how it did get there.
The bridge example
Imagine there is a bridge between your Javascript world and the DOM world. Each time you want to access an element (a "citizen") from Javascript in the DOM world, you need to cross that bridge.. but that is not for free.. you need to pay a pretty expensive toll.
So you should only go that way once and therefore only pay once.
If you know the exact position of the element (which is stored in a variable) you can just access it in no time.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…