Move sampling and meshing off the page into a few Web Workers, hand the finished arrays back without copying them, and keep the page responsive while the chunks are built.