Re: [PATCH] Fix bug 5880 - very slow in setting language on entire document

Date: Fri Jan 16 2004 - 18:09:55 EST

  • Next message: Jaume Vicent Hurtado i Perea: "UNSUBSCRIPTION"

    > Here's my proposed patch to fix bug 5880, attached as bug5880diff.txt.
    > I'm not sure if I understood all the code but my patch seems to give the
    > same results. The large reduction in execution time does make me wonder if
    > my patch is wrong.
    > The cause of the slowdown when changing language for a large amount of
    > text
    > is that a change notification is sent for each char format modification to
    > a
    > text run. When the View gets a char format change notification, it gets
    > the
    > character format for the entire selection. This is an O(n) operation. When
    > you do this for all the text fragments in the doc, you've got an O(n^2)
    > operation.
    > Proposed fix is to defer the notifications until after the character
    > format
    > change has occurred for the entire selection. After the change, the
    > notification is sent out.
    > This patch will affect any operation which changes the format for a text
    > selection using PD_Document::changeSpanFmt. Other similar operations which
    > don't go thru this codepath may require similar mods.
    > More info can be found here:
    > <>
    > Resulting speedup:
    > 8500ms => 120ms on the test document from bug 5880.
    > Happy New Year,
    > J

    Hi Jonny,
             This is great work! From looking at the patch it appears to do
    exactly what is needed (by defering the notifications and redraws
    until the end of the span change). I'll apply it and run it
    through some tests later

    If it all works we can look at applying it to similar situations (like
    pasting, changing lists)



    > _________________________________________________________________
    > Find high-speed ‘net deals — comparison-shop your local providers here.

    This archive was generated by hypermail 2.1.4 : Fri Jan 16 2004 - 18:10:20 EST