# ICan you change 'Page Unresponsive' time setting?

**URL:** <https://discourse.processing.org/t/ican-you-change-page-unresponsive-time-setting/31105>\
**Category:** p5.js\
**Created:** [July 7, 2021, 8:12pm UTC](https://discourse.processing.org/t/ican-you-change-page-unresponsive-time-setting/31105 "2021-07-07T20:12:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![BigBigRed](https://avatars.discourse-cdn.com/v4/letter/b/d6d6ee/32.png) [@BigBigRed](https://discourse.processing.org/u/BigBigRed)\
**Post date:** [July 7, 2021, 8:12pm UTC](https://discourse.processing.org/t/ican-you-change-page-unresponsive-time-setting/31105/1 "2021-07-07T20:12:45Z")

</div>

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?

Thanks

---

<div class="post-metadata">

**Author:** ![KumuPaul](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kumupaul/32/13072_2.png) [@KumuPaul](https://discourse.processing.org/u/KumuPaul)\
**Post date:** [July 7, 2021, 10:54pm UTC](https://discourse.processing.org/t/ican-you-change-page-unresponsive-time-setting/31105/3 "2021-07-07T22:54:15Z")

</div>

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](https://stackoverflow.com/questions/10344498/best-way-to-iterate-over-an-array-without-blocking-the-ui/10344560#10344560)). If you want to get fancy you could also use a [Web Worker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API) to do you processing in a separate thread.

---

<div class="post-metadata">

**Author:** ![KumuPaul](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kumupaul/32/13072_2.png) [@KumuPaul](https://discourse.processing.org/u/KumuPaul)\
**Post date:** [July 7, 2021, 10:58pm UTC](https://discourse.processing.org/t/ican-you-change-page-unresponsive-time-setting/31105/4 "2021-07-07T22:58:06Z")

</div>

Additionally if you can describe the computation as a [fragment shader](https://webglfundamentals.org/webgl/lessons/webgl-shaders-and-glsl.html), 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.
