I have a basic html site (html5 , JavaScript, jQuery) that I have running on an iPpad2. I do basic testing with a Google Chrome, just to test layout images and copy etc. My real test however needs to be on an actual iPad.
On the iPad, my code seems to have a 2-4 second delay as compared to Chrome which loads instantly. I have been unable to find the bottleneck. I added alerts at various points in the code, but all the alerts appear immediately, one after the other and it seems the delay occurs after the last alert which is at the last line of code.
The alerts may be misleading as maybe the code is cached before its executed? Is there something I should look for or avoid in my code in order to speed things up on the iPad?
If you do not cache your selector results - mobile devices are susceptible to poor performance
what I mean is if you do this:
$("#someId").css(some, stuff);
$("#someId").css(other, stuffs);
$("#someId").attr(even, more);
compared to
var ourElement = $("#someId");
ourElement.css(some, stuff);
ourElement.css(other, stuffs);
ourElement.attr(even, more);
now if you are doing the prior "in the real world" - in loops, etc.. - it can amount to a huge performance detriment to mobile devices
good luck
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With