I feel like this is desperate grasping at straws. It is theoretically possible to make Angular nearly as fast or faster than React is out-of-the-box, but the pain involved in doing so is massive. Yes, it's easy with little 5-line code snippets, but try doing so in a reasonably-sized application. It's hell.
React makes it easy to be fast by default. You generally don't even have to think about performance, and if you do have to, it is very easy to grasp. You don't need to frantically search extremely poor documentation.
How to optimize a React application: Implement shouldComponentUpdate. Or if you want performance by default, just use immutable data structures.
How to optimize an Angular application: Keep your scopes small. Keep it under 2000 watchers. Pollute your code with one-way bindings. Still no improvement? Oh, you need to do one-way binding here, too, in some obscure way. Don't watch functions. Don't watch objects. No $broadcast or $emit. Don't have big arrays. Should I use $digest or $apply? Why is this watcher causing the digest loop to take 500 ms to execute? No filtering or sorting unless you want to go mad. Did I mention using filters causes $index to be invalidated? How the hell do I even find out what's performing poorly?
I don't even know if any of that is correct anymore. It's too painful to remember. I want to be liberated and forget the literal hell that is Angular 1.x.
A majority of complaints about Angular's performance are solved by not using everything Angular throws at you. Don't use watchers, don't use two-way data binding, don't use events. It's taken a while for Angular developers to learn this, but it's been learned and it's time to get over it. Jumping ship isn't the answer because the grass is rarely greener on the other side.
You can also make manual DOM manipulation very performant. You can make jQuery very performant. More performant than React, for sure. The nice thing about React is that you have to try pretty hard to bomb performance. The framework gives you performance for almost free.
Jumping ship isn't the answer because the grass is rarely greener on the other side.
Jumping ship from Angular 1.x in the near future is almost definitely a winning bet.
29
u/cgaudreau senior HTML9 engineer Jun 01 '15
I feel like this is desperate grasping at straws. It is theoretically possible to make Angular nearly as fast or faster than React is out-of-the-box, but the pain involved in doing so is massive. Yes, it's easy with little 5-line code snippets, but try doing so in a reasonably-sized application. It's hell.
React makes it easy to be fast by default. You generally don't even have to think about performance, and if you do have to, it is very easy to grasp. You don't need to frantically search extremely poor documentation.
How to optimize a React application: Implement
shouldComponentUpdate. Or if you want performance by default, just use immutable data structures.How to optimize an Angular application: Keep your scopes small. Keep it under 2000 watchers. Pollute your code with one-way bindings. Still no improvement? Oh, you need to do one-way binding here, too, in some obscure way. Don't watch functions. Don't watch objects. No
$broadcastor$emit. Don't have big arrays. Should I use$digestor$apply? Why is this watcher causing the digest loop to take 500 ms to execute? No filtering or sorting unless you want to go mad. Did I mention using filters causes$indexto be invalidated? How the hell do I even find out what's performing poorly?I don't even know if any of that is correct anymore. It's too painful to remember. I want to be liberated and forget the literal hell that is Angular 1.x.