Make parsing super-large script/cdata/whatever blocks faster by using

size_forward as a lower-bound estimate for actual distance to end of string.
Bug 171124, r+sr=dbaron
This commit is contained in:
bzbarsky@mit.edu
2003-10-30 02:34:03 +00:00
parent a0c489366d
commit 21d76eb604
2 changed files with 4 additions and 2 deletions

View File

@@ -595,7 +595,8 @@ nsresult CTextToken::ConsumeUntil(PRUnichar aChar,PRBool aIgnoreComments,nsScann
PRBool found = PR_FALSE;
nsReadingIterator<PRUnichar> gtOffset,ltOffset = theCurrOffset;
while (FindCharInReadable(PRUnichar(kLessThan), ltOffset, endPos) &&
Distance(ltOffset, endPos) >= termStrLen) {
((PRUint32)ltOffset.size_forward() >= termStrLen ||
Distance(ltOffset, endPos) >= termStrLen)) {
// Make a copy of the (presumed) end tag and
// do a case-insensitive comparison