简体   繁体   English

为什么JQuery需要快速

[英]Why does JQuery need to be fast

I have searched through the JQuery tag on SO. 我在SO上搜索了JQuery标签。 I have seen many posts that are concerned with JQuerys speed. 我见过很多关于JQuerys速度的帖子。 I have been working with JQuery for about a year now and never experienced any speed issues. 我已经使用JQuery大约一年了,从未遇到任何速度问题。 I even worked with previous versions of JQuery before all the performance improvements and I never saw any speed issues. 在所有性能改进之前,我甚至使用过以前版本的JQuery,我从未见过任何速度问题。 I would like to ask what do people use JQuery for to need speed? 我想问一下人们使用JQuery需要什么速度?

我想说动画是JQuery需要具备的功能之一。

Because jQuery has become the de factor standard DOM manipulation library. 因为jQuery已成为de factor标准DOM操作库。

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. 对于交互式,流畅的用户体验,它需要快速。

I would like to ask what do people use JQuery for to need speed? 我想问一下人们使用JQuery需要什么速度?

  • Client side templating. 客户端模板。 Sending only JSON data over the wire and rendering the page entirely through JavaScript 仅通过线路发送JSON数据并完全通过JavaScript呈现页面
  • Mobile browsing. 移动浏览。 Mobile devices are a lot slower then desktops. 移动设备比台式机慢得多。 So it simply needs to be efficient and fast for a good user experience. 因此,只需要高效快速地获得良好的用户体验。

One of the main issues is that people are simply writing inefficient jQuery code and expecting it to be fast. 其中一个主要问题是人们只是编写低效的jQuery代码并期望它快速。 People have also stopped doing raw DOM manipulation for speed and are expecting jQuery to be just as fast. 人们也已停止对速度进行原始DOM操作,并期望jQuery同样快。

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 ;) 因此速度在这种情况下是重要的,它永远不会伤害保留它;)

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 :). 我相信JQuery最近的一个动画改进现在是使用requestAnimationFrame(http://paulirish.com/2011/requestanimationframe-for-smart-animating/),这有助于减少不必要的CPU周期,从而延长电池寿命: )。

With JavaScript libraries being so popular now, most progress is good for the web as a whole 随着JavaScript库现在如此受欢迎,大多数进展对整个网络都有好处

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM