Sure, I can make that change. After that is it ok to commit?<br><br><div class="gmail_quote">On Thu, Oct 18, 2012 at 9:43 AM, Douglas Gregor <span dir="ltr"><<a href="mailto:dgregor@apple.com" target="_blank">dgregor@apple.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Oct 17, 2012, at 6:04 PM, Craig Topper <<a href="mailto:craig.topper@gmail.com">craig.topper@gmail.com</a>> wrote:<br>
<br>
> This patch uses the line number cache to find the start of the line instead of searching backwards for it. This helps performance in cases where the line is long and have just called getLineNumber for the same position.<br>
<br>
</div>This only helps when the FilePos is exactly the same as the FilePos that went to getLineNumber:<br>
<br>
+ // See if we just calculated the line number for this FilePos and can use<br>
+ // that to lookup the start of the line instead of searching for it.<br>
+ if (LastLineNoFileIDQuery == FID && LastLineNoFilePos == (FilePos + 1)) {<br>
<br>
Why not simply check that FilePos > SourceLineCache[LastLineNoResult - 1] and < SourceLineCache[LastLineNoResult], so anything on the most-recently-queried line can be handled efficiently?<br>
<br>
- Doug<br>
<br>
</blockquote></div><br><br clear="all"><br>-- <br>~Craig<br>