为什么 JQuery 需要快
我已经搜索过 SO 上的 JQuery 标签。我看过很多与 JQuery 速度有关的帖子。我使用 JQuery 已经大约一年了,从未遇到过任何速度问题。在所有性能改进之前,我什至使用过以前版本的 JQuery,并且从未见过任何速度问题。我想问一下人们使用JQuery 是为了追求速度?
I have searched through the JQuery tag on SO. I have seen many posts that are concerned with JQuerys speed. I have been working with JQuery for about a year now and never experienced any speed issues. I even worked with previous versions of JQuery before all the performance improvements and I never saw any speed issues. I would like to ask what do people use JQuery for to need speed?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我想说动画是 JQuery 需要高性能的事情之一。
I would say animations is one of the things JQuery needs to be performant for.
因为 jQuery 已经成为事实上的标准 DOM 操作库。
每个人都关心速度增益。人们开始越来越多地推动浏览器的发展,大量渲染工作在客户端完成。
为了获得交互式、流畅的用户体验,它需要足够快。
主要问题之一是人们只是编写低效的 jQuery 代码并期望它很快。人们也不再为了速度而进行原始 DOM 操作,并期望 jQuery 也能同样快。
Because jQuery has become the de factor standard DOM manipulation library.
And everyone cares about speed gains. People are starting to push the browsers more and more with a lot of rendering being done on the client.
For an interactive, fluid, user experience it needs to be fast.
One of the main issues is that people are simply writing inefficient jQuery code and expecting it to be fast. People have also stopped doing raw DOM manipulation for speed and are expecting jQuery to be just as fast.
当然,这并不是每个人的情况,但许多开发人员希望允许使用性能较差的设备(例如智能手机、上网本和旧电脑)的用户看到他们的网站完美无缺。因此,在这种情况下,速度很重要,并且保留它永远不会有坏处;)
Well, of course it's not everyone's case, but many developers would like to allow users with less capable devices (such as smartphones, netbooks and old computers) to see their website flawlessy. So speed is something important in this case, and it never hurts preserving it ;)
这取决于您使用什么来衡量速度 - 移动设备和不寻常客户端(例如电视内置浏览器)上的设备可能无法高速渲染。
我相信 JQuery 最近的动画改进之一是使用 requestAnimationFrame (http://paulirish.com/2011/requestanimationframe-for-smart-animating/),这有利于减少不必要的 CPU 周期,从而延长电池寿命: )。
随着 JavaScript 库现在如此流行,大多数进步对整个 Web 都是有利的
It depends what you're using to benchmark your speed - mobile devices and those on unusual clients such as browsers built into TVs are likely to be much less capable of rendering at high speed.
I believe one of the recent animation improvements in JQuery now is to use requestAnimationFrame (http://paulirish.com/2011/requestanimationframe-for-smart-animating/) which is good for reducing needless CPU cycles and thus increases your battery life :).
With JavaScript libraries being so popular now, most progress is good for the web as a whole