Skip to content

Reuse range iterator across renders (or more efficiently batch renders together) #43

@caffodian

Description

@caffodian

Huge part of current cost is that the first getNextRange() call on a range iterator sucks: (see the comment on first iteration)

http://docs.ckeditor.com/source/rangelist.html#CKEDITOR-dom-rangeListIterator-method-getNextRange

We pass the range iterator an array of ranges indicating the bad words in the current block. This means that in cases where the block has 1 typo are as slow to mark as blocks that have 99 typos.

some numbers:

in a typical actual-paragraph, the first getNextRange() takes 18ms due to the setup step. Subsequent calls to getNextRange() for additional words are 0.13ms or so.

This also explains why tables can be so stupid:

Suppose you have a table of 1 acronym for cell, each cell will create a new iterator (because each cell is a paragraph.) This is stupid.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions