Profile mobile Safari (iPad) javascript?

陌路散爱 提交于 2019-12-19 15:40:12

问题


Javascript performance on mobile Safari (iPad) is much more sensitive for my application that it is on the desktop. Some operations that work super-smooth on the desktop take a while on the iPad, and I'd like to track down where the bottlenecks are. Is there some way to profile Javascript code on the iPad?


回答1:


If you have access to an Android phone, you can profile your application using desktop Chrome's developer tools and a USB cable (very convenient).

Android and iPhone behave+perform similarly, but not identically. That said, for 90% of use cases, if you improve performance on Android, you'll see the same improvements on iPhone.

Hour for hour, at least for the first pass of profiling, I think you'll get better results on iPhone using chrome+android to profile than using a less rich toolset.

https://developers.google.com/chrome/mobile/docs/debugging

It'll require Chrome, an Android device able to run the android Chrome app, and a USB cable.

You have to install and use the ADB console command, but once its working, you'll have the full chrome developer tools interface available for debugging mobile.




回答2:


You could try using a javascript profiling library (using timers for example) by a bit of searching I've found http://remysharp.com/2007/04/20/performance-profiling-javascript/ but since I didn't test it I can't tell you if its any good. You could place timers at various locations in your code and try to track down the bottlenecks that way.

(Js Microtime Library http://phpjs.org/functions/microtime:472)



来源:https://stackoverflow.com/questions/5384575/profile-mobile-safari-ipad-javascript

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!