Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is Angular faster than pure JavaScript when considering DOM manipulation?

This is what I know so far:

  • when modifying DOM, Javascript vanilla does that directly and every time so it is computationally expensive
  • I know that React and Vue.js use virtual DOM so they do not update the real DOM if it is unnecessary but what about Angular. How does Angular do that?

In a real world app does it really matter which one is faster?

like image 724
Matthias L Avatar asked Oct 17 '22 14:10

Matthias L


1 Answers

How does Angular do that?

As already mentioned, Angular has its own change detection strategy. Long story short, it patches some specific objects (like browser events, xmlHttpRequest, timeout and so on) to know when to start checking and checks values that matter

So this kinda mix with events and dirty checking. If you want some comparison - try to check this article

In a real world app does it really matter which one is faster?

In a real world all depends on requirements and situation. You should start from the question -what do I want to achive? If you want flexibility - take React. If you want more stable structure and guidelines - take Angular. If you want compromise - take Vue. If you need to save client traffic - try Hyperapp or smth like that.

And to be honest, Angular, React and Vue are fast enough for most of applications so you shouldn't worry about that from start.

like image 122
Drag13 Avatar answered Nov 02 '22 05:11

Drag13