DescriptionRefactor CollectionIndexCache for clarity and performance
Refactor CollectionIndexCache for clarity and performance:
- Split nodeBeforeOrAfterCachedNode() method into nodeBeforeCachedNode()
nodeAfterCachedNode().
- Simplify and inline isLastNodeCloserThanLastOrCachedNode() /
isFirstNodeCloserThanCachedNode() code.
- Simplify a lot the branching in nodeAt().
- In nodeAt(), handle the case where the cache is valid first as it is
more common and handle all cases where the cache is valid together
(i.e index == cachedIndex, index < cachedIndex, index > cachedIndex).
- Comment the code for clarity.
The Bindings/node-list-access.html is 2-3% faster with this patch.
This CL is based on the following WebKit revision by <antti@apple.com>:
http://trac.webkit.org/changeset/158698
R=esprehn, adamk
Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=167230
Patch Set 1 #Patch Set 2 : Rebase #Patch Set 3 : Rebase #Messages
Total messages: 4 (0 generated)
|