分析 jQuery 选择器性能?
是否有任何类型的分析工具来分析站点上选择器的性能(即 dom 上的迭代次数、每次搜索所需的平均时间、搜索次数等)?是桌面工具,还是 jQuery 插件还是其他什么?
我们发现 jQuery 执行的选择器搜索数量会影响性能。
当我在 Google 中搜索这个主题时,我发现很难获得在 jQuery 中使用 Google Analytics 的所有结果(这不是我想要的!)
Is there an analytics tool of any kind to analyse the performance of selectors on a site (ie. number of iterations over the dom, average time taken for each search, number of searches etc.)? Either a desktop tool, or a jQuery plugin or anything?
We are finding performance is being impacted by the number of selector searches jQuery is doing.
When I search this topic in Google I found it hard to get past all the results for using Google Analytics in jQuery (This is not what I want!)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
John Resig 自己有一个插件可以分析网站上的 jQuery 性能。
http://ejohn.org/blog/deep-profiling-jquery-apps/< /a>
我会检查一下,看看进展如何!
编辑:这本质上仍然是在页面级别。我真的在寻找网站级别的东西......
John Resig himself has a plugin which analyses jQuery performance on a site.
http://ejohn.org/blog/deep-profiling-jquery-apps/
I will check it out and see how it goes!
Edit: This is still essentially at a page level too. I am really looking for something that is at a site level...
还没有尝试过,但“DOM Monster”小书签看起来很有帮助。如果您购买 JavaScript Performance Rocks 电子书(请参阅 http://jsrocks.com),即可获得它
Haven't tried it but the "DOM Monster" bookmarklet looks helpful. You get it if you buy the JavaScript Performance Rocks eBook (see http://jsrocks.com)
我将自己在 jQuery 中的选择器代码中添加几个钩子,这些钩子将写入存储分析数据的 cookie,以分析整个站点的性能。
目前看来,此功能并不容易实现。
I am going to add a couple of hooks to the selector code in jQuery myself, which will write to cookies that store analytics data to analyse the performance across a site.
This functionality does not appear to be easily available at this point.