Huge speed problem on iPad (perf of "fnCallback")...
Huge speed problem on iPad (perf of "fnCallback")...
tommck
Posts: 73Questions: 0Answers: 0
I am using DataTables 1.8.1 (tried 1.8.2.nightly as well) with the Scroller plugin. When I load data, it is grabbing 39 rows of data (total of 9 columns) from the server (using bServerSide=true and ajax).
On Desktop Safari, the call to fnCallback takes, on average, about 250ms. On iPad Safari, it takes approximately 3000ms.
Is there anything obvious or simple that could be going on that would cause this kind of speed problem on the iPad? I know the browser is different and slower, but I didn't expect a > 10 times difference running DataTables functions there.
Any help would be _greatly_ appreciated!
On Desktop Safari, the call to fnCallback takes, on average, about 250ms. On iPad Safari, it takes approximately 3000ms.
Is there anything obvious or simple that could be going on that would cause this kind of speed problem on the iPad? I know the browser is different and slower, but I didn't expect a > 10 times difference running DataTables functions there.
Any help would be _greatly_ appreciated!
This discussion has been closed.
Replies
Allan
I don't know of any other profilers...
[quote]
JavaScript Profiler
Optimize your JavaScript code using the state-of-the-art JavaScript Profiler in the Profiles pane. The Profiler lists the performance characteristics of each of your script’s functions, making it easy to pinpoint problem areas and drill down to the offending lines of code.[/quote]
Ipad's Safari has a profiler. Safari is WebKit (hey! DataTables example tables came in handy!) and probably has same/similar debugger as Chrome.
http://stackoverflow.com/questions/6160073/profile-javascript-on-ios
Also, the loop to draw the rows inside _fnDraw is taking ~1400ms
I'll dig in more
1) the if/else block starting with "if (o.oScroll.sX === "") takes 231ms
2) the if block starting with "if (o.nTFoot !== null)" takes 297ms
3) The block starting with the comment "Recalculate the sanity width " and ending with "$(anHeadSizers).height(0);" takes 316ms
"_fnCreateTr" logic took 930ms
"_rowCallbacks" took 398ms (I know this is my logic)
It's pretty much a show stopper for code that should already have been in production at this point. I'd really appreciate any hints/help I can get
is there a "virtual" iPad you can test on, that gives you more info on system internals and debugging/profiling?
I'm having issues with Ipad perfomance too and the measures i get are really akward.
Thanks
I'm willing to believe it's really up to Apple to come up with something that performs better, but in the meantime a snappier application is a better one. ;-)
I found the answer in http://mir.aculo.us/2010/06/04/making-an-ipad-html5-app-making-it-really-fast/
My solution has been this one: https://github.com/gnuine/ubiquo_core/commit/37287fb77ae779d1ddb250add0a0b60ca73c73ab
Good luck!
T
So, basically, it's pure web dev optimization like:
* Favor single jQuery delegate() calls to binding events in the fnRowCallback or something like that
* Cache images if you can. (Make sure your server-side code is set up for far-future caching of any images you can).
* Minify/combine JS, etc
When it's done, Allan said he'd post it here in "Extras"