Closed Bug 347746 Opened 18 years ago Closed 18 years ago

Spell checker causes high cpu in this testcase

Categories

(Core :: Spelling checker, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: martijn.martijn, Assigned: mscott)

Details

(Keywords: perf, testcase)

Attachments

(1 file)

See upcoming testcase, which is much slower when the spell checker is on for the textarea.

The testcase updates the textarea.value every 50ms, and in this case it seems as if all the words in the textarea are re-spell checked.
It seems there could be some optimisation here, since most of the text doesn't change.

Forums also use this kind of code to add bb-tags or smiley code, for example, so this isn't entirely a theoretical situation (although the slowness is probably not noticed, because you typically only press once to add a smiley/bb-tag).
Attached file testcase
When you set the value, the value is replaced. The text is totally new, we have new DOMNodes, new frames, new everything.

The current spellcheck misspellings are DOM ranges that refer to old DOMNodes and old positions. When you replace the text, all of these go away. We MUST re-spellcheck the entire document or there will be no misspellings marked.

The only possible optimization here would be on value setting, where it could notice that the new value is actually the old value plus something else, and append new text instead. I'm not sure what the ramifications of this would be, and I would argue that it's probably not worth it. If you disagree, you can refile under the DOM component or something.
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: