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.
But that's the point – probably every technology can be hacked to make it good enough for your needs, but the objective of good design is to provide you with essential tools and encourage you to do things the right way, so you DON'T have to think about it all the time.
Not using the bad parts isn't "hacking something to make it good enough." It's learning from others and the warts of a given technology and not using those warts.
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.