| Differences between
and this patch
- WebCore/ChangeLog +14 lines
Lines 1-3 WebCore/ChangeLog_sec1
1
2009-09-23  Shu Chang  <Chang.Shu@nokia.com>
2
3
        Reviewed by NOBODY (OOPS!).
4
5
        Optimize the code so only the text from start to end is scanned.
6
        https://bugs.webkit.org/show_bug.cgi?id=29092
7
8
        On a platform with webkit+Qt+Symbian, the parsing time for a 600K text
9
        file improved from 400ms to 40ms (10x faster).
10
        Ran WebKitTools/Scripts/run-webkit-tests, and no new problem was found.
11
12
        * dom/Text.cpp:
13
        (WebCore::Text::createWithLengthLimit):
14
1
2009-09-23  Gustavo Noronha Silva  <gns@gnome.org>
15
2009-09-23  Gustavo Noronha Silva  <gns@gnome.org>
2
16
3
        Reviewed by Xan Lopez.
17
        Reviewed by Xan Lopez.
- WebCore/dom/Text.cpp -4 / +6 lines
Lines 315-324 PassRefPtr<Text> Text::createWithLengthL WebCore/dom/Text.cpp_sec1
315
    unsigned end = start + min(charsLeft, maxChars);
315
    unsigned end = start + min(charsLeft, maxChars);
316
    
316
    
317
    // Check we are not on an unbreakable boundary.
317
    // Check we are not on an unbreakable boundary.
318
    TextBreakIterator* it = characterBreakIterator(data.characters(), dataLength);
318
    if (end < dataLength) {
319
    if (end < dataLength && !isTextBreak(it, end))
319
        TextBreakIterator* it = characterBreakIterator(data.characters() + start, (end + 2 > dataLength) ? dataLength - start : end - start + 2);
320
        end = textBreakPreceding(it, end);
320
        if (!isTextBreak(it, end - start))
321
        
321
            end = textBreakPreceding(it, end - start) + start;
322
    }
323
    
322
    // If we have maxChars of unbreakable characters the above could lead to
324
    // If we have maxChars of unbreakable characters the above could lead to
323
    // an infinite loop.
325
    // an infinite loop.
324
    // FIXME: It would be better to just have the old value of end before calling
326
    // FIXME: It would be better to just have the old value of end before calling

Return to Bug 29092