The usual advice for a page that freezes during heavy work is to move the work into a Web Worker. It's good advice. In an earlier test, heavy jobs on the main thread (a 39 MB CSV, a 24-megapixel photo, a 400-page PDF) froze the page for 0.2 to 0.6 seconds, while the same jobs in a worker kept every frame on time. I also measured the trip into the worker: transferring a 256 MB buffer took 0 to 10 ms, copying it 179 to 248 ms.
After that piece, a reader pointed out the half I hadn't measured: the result has to come back. The worker's whole point is a result the page can show, and that result travels to the main thread through postMessage too. If it gets copied, the copy is unpacked on the main thread , which is exactly the thread you were trying to protect.
So I measured the return trip.
The short version:
A copied buffer froze the page for up to 317 ms at 256 MB in Chrome (up to 200 ms in Firefox).…