CPU Optimization - Mobile & Servers: Loading Times

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? :slight_smile:

Thanks for your help and ideas!

Margaret

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 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.

1 Like

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?

2 Likes

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.

1 Like

Hi Noel :slight_smile:

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?

1 Like

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

1 Like

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?

1 Like

Well, give it a try and ask him.

1 Like

I did. :slight_smile:

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

2 Likes

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.”

1 Like

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 because once you make an account there, you are able to save your sketches and can be accessed publicly.

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?

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

1 Like

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.

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 !

Hi InterNova,

I posted my code in the projects section:

Thanks for checking it out!