ICan you change 'Page Unresponsive' time setting?

I have an idea that I am trying to implement in a sketch. so I am running a loop to calculate the value of each pixel in a 300 * 300 canvas. So I get the ‘Page Unresponsive: Wait or Cancel’ pop up before the sketch draws. Is the timer for ‘Page unresponsive …’ something that I can increase somehow?


The browser reporting that a page has become unresponsive is purely a non-standards based browser capability and generally not something you can change. However there are several ways to handle slow computations. The simplest would be to perform the processing in smaller chunks, persist the computed values in an array or other data structure, and then have the draw() function simply draw from the array. You have several options as to how to run the chunks of computation, you could trigger computation for a single chunk per call to draw(), or you could initially trigger processing from setup() or some other triggering function and use setTimeout() to continue processing chunks (see: javascript - Best way to iterate over an array without blocking the UI - Stack Overflow). If you want to get fancy you could also use a Web Worker to do you processing in a separate thread.

Additionally if you can describe the computation as a fragment shader, which would require your computation to be parallelize and based inputs that are either uniform for all pixels or data that you could encode in a texture, you could make your computation very fast, especially when hardware acceleration is enabled.