News for hackers. Stuff that matters.
Re:Modernizing the DOM Tree in Microsoft Edge by yorwba on Thursday April 20, 2017 @12:42AM (#14154026)
If no insertions or deletions happen between accesses, a vector scan can also be done with only a single indirection, by simply incrementing the pointer to the node. This also means better locality than a linked list, where the next pointer may be close to the current node, while the next node can be anywhere. In a vector, they are simply next to each other.
Re:Modernizing the DOM Tree in Microsoft Edge by jdmichal on Thursday April 20, 2017 @11:15AM (#14157404)
That's true when you have a `vector<node>`, but the structure was described as a `vector<node*>`. So what's adjacent to your current position is the pointer to the next node, not the node itself.

Which one is optimal depends a lot on the size of a `node`, as moving elements around in the DOM will require memory copies in the first case.