[PATCH] Sonnet::Highlighter API additions

Maksim Orlovich mo85 at cornell.edu
Fri May 2 17:12:35 BST 2008


> The reason why this patch is needed is that the current method of
> suggesting
> replacements for a misspelled word is horribly inefficient: When a
> misspelled
> word is detected, the highlighter emits
> newSuggestions(QString,QStringList),
> which has the wrong word and a list of suggestions as parameters.
The
> client
> (KMail in this case) then has to store a map of wrong words and their
> replacement suggestions. With long texts, this map can get quite big,
> especially because words are marked wrong when writing them, so the signal
> is
> emitted for word-fragments as well (for example, "ex", "exa", etc for
> "example").

While I can't approve it, I'd like to second the rationale for the patch.
There are other performance problems with the design than what you
mentioned, actually --- just the computation of the suggestions list for
the newSuggestions signal can be extremely slow, and the highlighter does
a lot of recomputation. Hence the performance hack I put in to not compute
it if newSuggestions isn't connected --- w/o that hack, pastebin'ing a
patch would cause Konqueror to freeze for half a minute or so, computing
those suggestions. Anyway, may I suggest adding a note to the API docs for
newSuggestions saying that it's extremely inefficient?

P.S. "missspelled" is misspelled.






More information about the kde-core-devel mailing list