Chromium Code Reviews
DescriptionOptimize LineInfo.getLocation().
Three simple optimizations:
1. Do a binary search through _lineStarts to find the line instead of linear.
2. Store the last result and see if the offset starts there or later. If so, skip leading lines when searching.
3. See if the current offset is on the same line as the last result and exit early if so.
On my benchmark test for the formatter, this reduced it from 13.23ms to 7.57ms.
R=brianwilkerson@google.com
Committed: https://code.google.com/p/dart/source/detail?r=41452
Patch Set 1 #
Messages
Total messages: 5 (1 generated)
|
|||||||||||||||||||