rangy
rangy copied to clipboard
TextRange.saveCharacterRanges is quite slow for very large documents
I have a document that contains over a million characters. I am trying to save selection which is at the bottom of the document, and I found that saveCharacterRanges takes a really long time.
Most of the time is spent by CharacterIterator trying to find the starting position of the selection.
Is there a more efficient way to find this starting position?
Use case: I am trying to serialize characterRange and then deserialize it.
It can't be denied that the TextRange module scales badly. There is similar, faster but less sophisticated functionality built into Rangy's core: getBookmark() and moveToBookmark().