Use a binary search on the elements list rather than an in-memory elementIndexes which turns out to be unmanageable for larger texts with lots of edits. Remove elementIndexes.
Use a binary search on the elements list rather than an in-memory elementIndexes which turns out to be unmanageable for larger texts with lots of edits. Remove elementIndexes.

PenguinF/sandra-three