0

I'm on top of the fence, I can't decide between jQuery and Angular, I do understand this is an Oranges and Bricks comparison, Frameworks and Libraries, but for a task I was expecting Angular to outperform jQuery, it didn't, multiple times. Is the result of my tests true, and how and when should I use jQuery or Angular?

This is not a subjective or opinion-based question, Angular and jQuery are tools not art, so facts and tests should be used to back up your point.

Here's a snapshot of a test on perf, I know it's not perfect and can vary, but angular is always behind in this specific test:

Live Test Here (Warning: it might freeze your browser)

enter image description here

8
  • I know you want facts and tests, but considering that Angular contains a scaled down jQuery engine, why would you think that an Angualr wrapper to a jQuery operation would be faster than the jQuery operation? Commented Mar 10, 2016 at 20:29
  • @ScottMarcus I thought for Angular being "lighter" it would consequently "faster" Commented Mar 10, 2016 at 20:31
  • Where did you get the impression that Angular was lighter? Angular is actually known to have a fairly significant load overhead and it is only recommended for SPA's where you take the hit once. On multi-page applications, it's usually not the best choice because you have to load it on each page call. jQuery is MUCH lighter than Angular. Commented Mar 10, 2016 at 20:33
  • @ScottMarcus I've been bombarded by a lot of people saying that Angular was lighter than jQuery on some tasks, and I set out for testing Angular's performance and I've been quite unsatisfied with it, but people still hammer on that, that's why I asked for facts, and I know that here on SO, I would find solid and backed up information, not just opinions Commented Mar 10, 2016 at 20:36
  • I'm sorry that I'm not providing benchmarks for you. Perhaps someone else will. But, there is truth to Angular doing some tasks faster than just jQuery, but it will depend on what those tasks are. Creating / iterating arrays is fairly close to the JavaScript metal and jQuery is closer to that metal than Angular. For two way databinding and structuring code in an MVC pattern, Angular shines. Commented Mar 10, 2016 at 20:38

1 Answer 1

1

It would be highly intense to debate Angular vs. jQuery , Its really more about what task you'll need to do before you make the decision on which tool you use . So to keep this straight forward , in our workplace we handle very large amounts of data so "data-binding" and keeping a modular work flow is very critical , in this case Angular is our main tool , its very robust and allows for more file/code organization. Now on the other hand in my freelance web design work I almost always use jQuery as it is much faster at getting small tasks done, but also allows the possibility for what we call "spaghetti code". Hope this helps!

Sign up to request clarification or add additional context in comments.

2 Comments

For myself, I rarely use jQuery for trivial tasks, like working with primitives or iteration. You must remember that the "j" in jQuery stands for JavaScript. As such, it's important to remember that it is just a wrapper around JavaScript an so it will be intrinsically slower at many tasks than straight JavaScript would be. Often, using jQuery doesn't even do the job with less code. It is only when I can reduce code or perhaps perform a task that would otherwise be too complex that jQuery makes sense.
That's my case too, I don't like overusing jQuery specially for appending or mapping, that makes me worried, it's kind of slow

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.