quilljs/quill — pull request #92 by philippotto (2014-05-10 19:42:08+00:00)
Title: Support for batch formatting to improve speed

Hello,

I noticed that massive formatting of text tends to get rather slow when the text gets a little bit longer.
Small example: When formatting every word in a 2000-character text it takes approx. 2000 ms.

I added a batchFormatText method which takes an array of the parameters which get usually passed to formatText. For every element a delta is computed. These deltas get merged into one object which will be applied.
It is rather hacky since I tinker with the __proto__ attribute. And I think I handled the startLength and endLength properties wrong (what's the purpose of those?). But it seems to work and the tests pass.

To cut a long story short: The performance gain is a factor of 4 (2000-character take 500 ms, now). It is still rather slow but better than nothing. Maybe somebody gets inspired by this and has further ideas on how to improve the performance.

Thanks