Re:Writing a Non-Blocking JavaScript Quicksort
by yoklov on Wednesday June 10, 2015 @09:56AM
(#9692169)
It's massively unfortunate that a tradeoff like this has to be made (speed vs responsiveness).
But FWIW, you can do canvas pixel operations with a web worker, which you then blit to the canvas, which is acceptable in some cases.
Depending on what you're doing, you may want to yield after x operations rather than on every recursive invocation like the example shown. There is a performance cost to using setImmediate.