views:

458

answers:

9

Recently I had to convert some Javascript code to JQuery scripts. In this process I found that using JQuery do not speed up my site as much as I think. actually Javascript was faster in my case.

So I want to know that, Is JQuery Faster than Javascript or not ?

also

Whats the main advantages of JQuery to Javascript ?

+13  A: 

jQuery is written in Javascript. How could it possibly be faster?

EJP
I agree, but bear in mind that there are infinite ways you can write your code and it is easy to write a javascript code that achieves the same result and works slower than its jQuery equivalent. I think jQuery makes it a lot easier to avoid javascript complexity pitfalls especially when keeping multibrowser targetting in mind.
Michal Rogozinski
I never said otherwise. The question was 'Is jQuery faster than Javascript?' I answered that question.
EJP
Clearly, the fastest jQuery code couldn't be faster than the fastest straight up JavaScript code (since, by definition, the fastest jQuery code would also be the fastest JavaScript code).However, if a person wrote some very inefficient raw JavaScript, and then replaced it with jQuery library functions, it may very well speed up.
jboxer
Notwithstanding all that, which is self-evident, the fact remains that the original question amounts to a category mistake. The OP expected his site to speed up *just because* he introduced jQuery.
EJP
+24  A: 

jQuery is javascript.

The benefit of jQuery is the general cross browser abstractions of common javascript usages. These abstractions are generally not faster than raw dom manipulation, however the abstractions and wide documentation/support are generally worth while for the speed. jQuery is reported to be in most cases faster then other javascript libraries, that is probably where the confusion is.

Quintin Robinson
Yeah, jquerys' methodology will probably produce better results in a speed test, but you don't use jquery runtime speed, you use to for development speed and consistency.
karbon
+8  A: 

jQuery isn't a language. jQuery is a library. jQuery is written in JavaScript, and when you write code with jQuery, you're writing JavaScript. So it's not "faster than JavaScript". But it might be faster than the code you might write to do the same thing without jQuery, because you're probably not as good as jQuery's authors -- but then again performance isn't really the point. Quality, reusability, and programmer efficiency are.

hobbs
A: 

Jquery is built on top of javascript....

Pandiya Chendur
+4  A: 

jQuery couldn't faster than its parent language, Javascript.

But low quality javascript codes will be slower than jQuery for most cases.

S.Mark
`low quality javascript codes will be slower than jQuery` :). i like that +1
Rakesh Juyal
A: 

jQuery is slower because it takes time for the actual JS code to be generated.

jQuery is just a set of rules of JavaScript and it has to go through those to be executed, and therefore it'll be faster then JS. I think xD

zstklerjhtkl
+1  A: 

Since jquery uses javascript, it cannot be any faster. But that does not mean hand writing a complex javascript method will be wise.

fastcodejava
+1  A: 

1 document.getElementById('id').value='123'; //javascript native

2 $('#id').val('123'); //javascript native; //jquery

both that statements set the value of the element no doubt line 1 is faster

but ...

if you think this is a good reason to forget about jQuery you are totally out of the way

in this case, as you are a novice developer , i suggest you keep studing javascript native... then , as you feel comfortable with native javascript and want to raise to the next upper level move to jquery

for all the others here a good article about jquery performance http://www.artzstudio.com/2009/04/jquery-performance-rules/

luca
A: 

found this ! it makes me thinking indeed

http://www2.webkit.org/perf/slickspeed/

luca