phosphorjs / phosphor

The PhosphorJS Library
BSD 3-Clause "New" or "Revised" License
1.04k stars 169 forks source link

Handle long splices for textfield and listfield. #429

Closed ian-r-rose closed 4 years ago

ian-r-rose commented 5 years ago

Using Array.splice when the to-be-spliced values can run into browser limits for the most arguments allowed to be passed to a variadic function. This can happen especially when initializing a large text field (i.e., a few hundred thousand characters).

This PR implements an internal utility for splitting up large splices, getting around the browser limitations on the number of function args. The chunk size 100000 comes from some experimentation with Chrome and Firefox.

Now, text files of this size also start running into problems with ID sizes, which we still need to solve. But this is a mostly orthogonal problem.

ian-r-rose commented 4 years ago

Thanks for the review @blink1073. I'll need to make a follow-up here to resolve the logic error that @vidartf pointed out above.