# CPU Optimization - Mobile & Servers: Loading Times

**URL:** <https://discourse.processing.org/t/cpu-optimization-mobile-servers-loading-times/23280>\
**Category:** p5.js\
**Created:** [August 16, 2020, 12:08am UTC](https://discourse.processing.org/t/cpu-optimization-mobile-servers-loading-times/23280 "2020-08-16T00:08:16Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![mnoble](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/mnoble/32/99_2.png) [@mnoble](https://discourse.processing.org/u/mnoble)\
**Post date:** [August 16, 2020, 12:08am UTC](https://discourse.processing.org/t/cpu-optimization-mobile-servers-loading-times/23280/1 "2020-08-16T00:08:16Z")

</div>

Hello Forum,

I am working on a series of audio visual projects that I want people to access from a variety of mobile devices. I really love using the p5js Open Processing website in full screen mode (because it is ready to go and I am a novice at best)! My projects take about 5 seconds to load on my phone. My assumption is that loading time will vary depending on the user’s phone?

Or, is it the server that hosts the sketches that slows loading?

Both?

What can I do to optimize my load times for mobile devices in addition to optimizing my code? Is Open Processing as fast as it gets? Or, is there another cloud server that I could get my sketches hosted on that would be lightening? 🙂

Thanks for your help and ideas!

Margaret

---

<div class="post-metadata">

**Author:** ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)\
**Post date:** [August 16, 2020, 12:51pm UTC](https://discourse.processing.org/t/cpu-optimization-mobile-servers-loading-times/23280/2 "2020-08-16T12:51:51Z")

</div>

From my experience with Open Processing; What mostly determinate loading **and** run speed is the processor capacity of the mobile. The difference can really be big. For example in [this](https://www.openprocessing.org/sketch/886794) sketch I had to put a “loading screen” for slow devices, otherwise it would start messed up. On my daughters new iphone it runs really fast.

---

<div class="post-metadata">

**Author:** ![mnoble](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/mnoble/32/99_2.png) [@mnoble](https://discourse.processing.org/u/mnoble)\
**Post date:** [August 16, 2020, 5:07pm UTC](https://discourse.processing.org/t/cpu-optimization-mobile-servers-loading-times/23280/3 "2020-08-16T17:07:18Z")

</div>

Hi Noel,

Thanks for sharing - what a fun sketch! So, I think what I am wondering about is the white screen between clicking the link and getting to a loading screen like yours. When I loaded your sketch with my Mac Laptop 2015, I still had to wait about 5 seconds before your loading screen showed up. Is that period between clicking and getting to your loading a screen controlled by my device or the hosting server?

---

<div class="post-metadata">

**Author:** ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)\
**Post date:** [August 16, 2020, 5:14pm UTC](https://discourse.processing.org/t/cpu-optimization-mobile-servers-loading-times/23280/4 "2020-08-16T17:14:35Z")

</div>

> [@mnoble](#):
>
> Is that period between clicking and getting to your loading a screen controlled by my device or the hosting server?

In the code. The nice thing with Open Processing is that you can modify the code and test it on the fly. Just give it a try.

---

<div class="post-metadata">

**Author:** ![mnoble](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/mnoble/32/99_2.png) [@mnoble](https://discourse.processing.org/u/mnoble)\
**Post date:** [August 16, 2020, 5:18pm UTC](https://discourse.processing.org/t/cpu-optimization-mobile-servers-loading-times/23280/5 "2020-08-16T17:18:49Z")

</div>

Hi Noel 🙂

So what you are saying is that if the code is optimized there should be no lag time in loading?

I guess I am wondering about about the purpose of a load screen if the user still has to wait to see the load screen. Is there a way to program a load screen so it is not bogged down by the rest of the sketch and it shows instantly?

---

<div class="post-metadata">

**Author:** ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)\
**Post date:** [August 16, 2020, 5:20pm UTC](https://discourse.processing.org/t/cpu-optimization-mobile-servers-loading-times/23280/6 "2020-08-16T17:20:40Z")

</div>

Sorry I misunderstood. You said ‘before’ loading screen? That’s odd. I believe that is a server issue.

---

<div class="post-metadata">

**Author:** ![mnoble](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/mnoble/32/99_2.png) [@mnoble](https://discourse.processing.org/u/mnoble)\
**Post date:** [August 16, 2020, 5:22pm UTC](https://discourse.processing.org/t/cpu-optimization-mobile-servers-loading-times/23280/7 "2020-08-16T17:22:14Z")

</div>

Yes! I was thinking I could persuade Sinan from Open Processing to make an embedded loading screen for sketches in full screen? But, I was wondering if a sketch could be hosted on a super fast cloud server that performed better?

---

<div class="post-metadata">

**Author:** ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)\
**Post date:** [August 16, 2020, 5:24pm UTC](https://discourse.processing.org/t/cpu-optimization-mobile-servers-loading-times/23280/8 "2020-08-16T17:24:35Z")

</div>

Well, give it a try and ask him.

---

<div class="post-metadata">

**Author:** ![mnoble](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/mnoble/32/99_2.png) [@mnoble](https://discourse.processing.org/u/mnoble)\
**Post date:** [August 16, 2020, 5:27pm UTC](https://discourse.processing.org/t/cpu-optimization-mobile-servers-loading-times/23280/9 "2020-08-16T17:27:23Z")

</div>

I did. 🙂

I would definitely rather keep the sketch on Open Processing. I don’t even know if hosting on another cloud server would be faster?

---

<div class="post-metadata">

**Author:** ![mnoble](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/mnoble/32/99_2.png) [@mnoble](https://discourse.processing.org/u/mnoble)\
**Post date:** [August 17, 2020, 8:53pm UTC](https://discourse.processing.org/t/cpu-optimization-mobile-servers-loading-times/23280/10 "2020-08-17T20:53:50Z")

</div>

I got some helpful input from Sinan on OpenProcessing about loading times for mobile on server side:

“Loading issue is a little challenging. There are multiple different steps which could be causing the delay (ie. slow internet in general, sketch loading slow, phone being slow on certain actions, file preload), and it is not possible to create a catch all loading message. OpenProcessing servers are relatively fast, so I don’t see it being a server issue.”

---

<div class="post-metadata">

**Author:** ![InferNova](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/infernova/32/6009_2.png) [@InferNova](https://discourse.processing.org/u/InferNova)\
**Post date:** [August 17, 2020, 8:57pm UTC](https://discourse.processing.org/t/cpu-optimization-mobile-servers-loading-times/23280/11 "2020-08-17T20:57:51Z")

</div>

Hey there !

Also kind of curious that if sketches are so bogged down on mobile. I have made pure JS games for mobile within browser and have tested it on old devices ( Android 4 ) and really it ran pretty good even the smart TV was able to handle stuff so interesting to see what really is the first hand issue.

Maybe some code optimization could do the trick ?

Now running @noel sketch it super sluggish on my laptop for some reason and I have a pretty beefy machine ! So that strange.

edit:

Okay I didn’t know ! But open processing you just host your processing code, I thought it be P5.js so I am curious then does open processing host the project as an applet ?

Maybe converting the sketch to pure P5.js and just hosting the sketches on [P5.js](https://editor.p5js.org/) because once you make an account there, you are able to save your sketches and can be accessed publicly.

---

<div class="post-metadata">

**Author:** ![mnoble](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/mnoble/32/99_2.png) [@mnoble](https://discourse.processing.org/u/mnoble)\
**Post date:** [August 17, 2020, 9:18pm UTC](https://discourse.processing.org/t/cpu-optimization-mobile-servers-loading-times/23280/12 "2020-08-17T21:18:31Z")

</div>

Hi InferNova,

Thanks for your reply. You wrote:

> “you are able to save your sketches and can be accessed publicly”

I think it is the same for OpenProcessing as well. I really love their built in full screen mode for sharing.

Are you saying you think it would be faster to host on P5.js rather than OpenProcessing?

---

<div class="post-metadata">

**Author:** ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)\
**Post date:** [August 17, 2020, 10:24pm UTC](https://discourse.processing.org/t/cpu-optimization-mobile-servers-loading-times/23280/13 "2020-08-17T22:24:16Z")

</div>

> [@InferNova](#):
>
> Okay I didn’t know ! But open processing you just host your processing code, I thought it be P5.js so I am curious then does open processing host the project as an applet ?

Open Processing mostly hosts P5.js sketches now, but you can still use Processing.java although it’s limited.

---

<div class="post-metadata">

**Author:** ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)\
**Post date:** [August 17, 2020, 10:33pm UTC](https://discourse.processing.org/t/cpu-optimization-mobile-servers-loading-times/23280/14 "2020-08-17T22:33:47Z")

</div>

> [@noel](#):
>
> That’s odd. I believe that is a server issue.

I meant here your internet provider or even router. My sketch (link above) runs really fast on my humble Windows 7 machine. I only used the loading screen for slow mobile devices. The white screen @mnoble is talking about I sometimes get when I have a bad/slow internet connection.

---

<div class="post-metadata">

**Author:** ![InferNova](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/infernova/32/6009_2.png) [@InferNova](https://discourse.processing.org/u/InferNova)\
**Post date:** [August 18, 2020, 11:52am UTC](https://discourse.processing.org/t/cpu-optimization-mobile-servers-loading-times/23280/15 "2020-08-18T11:52:36Z")

</div>

I guess further assistance could be given in code refactoring to speed up the sketches so if you don’t mind could share the sketches or some versions of it so we can help out to see what the issue truly is !

---

<div class="post-metadata">

**Author:** ![mnoble](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/mnoble/32/99_2.png) [@mnoble](https://discourse.processing.org/u/mnoble)\
**Post date:** [August 18, 2020, 5:30pm UTC](https://discourse.processing.org/t/cpu-optimization-mobile-servers-loading-times/23280/16 "2020-08-18T17:30:05Z")

</div>

Hi InterNova,

I posted my code in the projects section:

> [@Visual Music for Mobile Devices](https://discourse.processing.org/t/visual-music-for-mobile-devices/23314):
>
> Hello Forum, I wouldn’t call this project a heroic feat in programming but I am hoping it provides a nice user experience for people waiting at the airport. The project is called [Sky][Muse] and is part of a series of simple programs accessible by mobile inspired by travel themes. This particular one riffs off early motion graphics using the contemporary generative style of p5js programming. If you had the time, I’d be grateful to know if it loaded on your mobile device? (or if you see any gla…

Thanks for checking it out!
