Live data from Hacker News

Improving Angular performance with 1 line of code

medium.com

91–100 of 118 posts

Re: Improving Angular performance with 1 line of code

#91

As someone who's specialized in AngularJS optimization [0], this doesn't surprise me in the least. Developers leave plenty of performance optimizations on the table, some worse than this one. The truth of the matter is that in the general case, it doesn't matter. We engineers like to go on and on about this or that perf efficiency but most of the time the code runs fast enough (and the majority of the time when it do…

>>The truth of the matter is that in the general case, it doesn't matter. We engineers like to go on and on about this or that perf efficiency but most of the time the code runs fast enough

THIS!

This is why battery life on mobile sucks

everyone who thinks this way is the reason

.

As everything moves to the web, the performance of your code matters

.

So what if my phone has just enough CPU to render your site? You should not be content with that - you should strive to use less, so my CPU can go to sleep faster.

.

Your job is supposed to be hard. you're an engineer! Please consider the consequences of your actions.

Re: Improving Angular performance with 1 line of code

#92
post #72

Earlier quoted context omitted.

Cheers for the explanation, but this isn't so much "DI", as "reflection for the sake of DI", right? I mean, libraries can have DI without being quite this magical. I say this naively as a non-user, but in my case this specifically is what made me decide not to use Angular. I was trying it out for a new project and running through tutorials, but when I realized it was being that clever behind the scenes I decided that…

Sure, Angular has strict DI, which looks like this: myApp.service('foo', ['bar', 'baz', function (bar, baz) { Now it doesn't need to read the function params as it has the strict strings. This'll survive function param mangling (a typical minification step). Sorry to hear you felt you weren't up to learning Angular & DI patterns. It can be tough for some folks who are still learning programming & JavaScript in genera…

> Sorry to hear you felt you weren't up to learning Angular & DI patterns. It can be tough for some folks who are still learning programming & JavaScript in general

I'm sure you don't mean that to sound condescending, but that's really not what I said. It was a question of magicalness vs. payoff - I needed a front-end framework that would handle a bunch of databinding and stay out of my way, and halfway into my first tutorial I found none of the sample code worked (either because I changed a local variable name or because my project already had minification set up, I don't recall). Either way the docs and tutorial I was using didn't even mention the function was being introspected, I had to go source-diving to find that out.

It all worked out to make Angular feel less like a framework and more like a career choice - I couldn't just give it idiomatic javascript and expect things to work. If this introspection thing is the one and only magical part of Angular and I just happened to trip over it, maybe I got the wrong impression.

Re: Improving Angular performance with 1 line of code

#93

As someone who's specialized in AngularJS optimization [0], this doesn't surprise me in the least. Developers leave plenty of performance optimizations on the table, some worse than this one. The truth of the matter is that in the general case, it doesn't matter. We engineers like to go on and on about this or that perf efficiency but most of the time the code runs fast enough (and the majority of the time when it do…

>>The truth of the matter is that in the general case, it doesn't matter. We engineers like to go on and on about this or that perf efficiency but most of the time the code runs fast enough THIS! This is why battery life on mobile sucks everyone who thinks this way is the reason . As everything moves to the web, the performance of your code matters . So what if my phone has just enough CPU to render your site? You sh…

I like this comment and I'd add one more thing:

Yes developers your developer-time is the most precious thing in the universe but please consider your user's time and their computing resources as well.

Re: Improving Angular performance with 1 line of code

#95

As someone who's specialized in AngularJS optimization [0], this doesn't surprise me in the least. Developers leave plenty of performance optimizations on the table, some worse than this one. The truth of the matter is that in the general case, it doesn't matter. We engineers like to go on and on about this or that perf efficiency but most of the time the code runs fast enough (and the majority of the time when it do…

Is there a linter or some such which will catch the most common of these mistakes?

Re: Improving Angular performance with 1 line of code

#96
post #43

Earlier quoted context omitted.

Depends. There's been lots of studies linking page speed to revenue. I would imagine it doesn't manifest much in lower traffic sites where there's too much noise for it to play out, but as you grow in your userbase, working fast starts to become necessary for it to work well.

The tone of your comment sounds like you think I said one should never look at performance. I do this professionally, I should hope folks out there need performance. Let me be clear: A developer should place performance priority in the Right Place, and a good dev will know where that is. Would you mind linking a few of these studies? I'm curious as to what the point of diminishing returns is. nngroup [0] says that 10…

And what makes it OK to burn X% additional battery life across all your users devices?

I take your general point but battery life is also a problem I have with React Native. Sure, you can drive animations from the JS thread and on modern devices in some cases you can't even tell the difference. But your battery can.

Re: Improving Angular performance with 1 line of code

#97

As someone who's specialized in AngularJS optimization [0], this doesn't surprise me in the least. Developers leave plenty of performance optimizations on the table, some worse than this one. The truth of the matter is that in the general case, it doesn't matter. We engineers like to go on and on about this or that perf efficiency but most of the time the code runs fast enough (and the majority of the time when it do…

>>The truth of the matter is that in the general case, it doesn't matter. We engineers like to go on and on about this or that perf efficiency but most of the time the code runs fast enough THIS! This is why battery life on mobile sucks everyone who thinks this way is the reason . As everything moves to the web, the performance of your code matters . So what if my phone has just enough CPU to render your site? You sh…

You don't even need a mobile phone to prove that. Every Adobe desktop software iteration takes twice than the previous one to open and offers pretty much the same functionalities just arranged in a different manner. And buggier.

Re: Improving Angular performance with 1 line of code

#98

As someone who's specialized in AngularJS optimization [0], this doesn't surprise me in the least. Developers leave plenty of performance optimizations on the table, some worse than this one. The truth of the matter is that in the general case, it doesn't matter. We engineers like to go on and on about this or that perf efficiency but most of the time the code runs fast enough (and the majority of the time when it do…

>>The truth of the matter is that in the general case, it doesn't matter. We engineers like to go on and on about this or that perf efficiency but most of the time the code runs fast enough THIS! This is why battery life on mobile sucks everyone who thinks this way is the reason . As everything moves to the web, the performance of your code matters . So what if my phone has just enough CPU to render your site? You sh…

> Your job is supposed to be hard. you're an engineer! Please consider the consequences of your actions.

My clients pay my wages and they are the ones who choose what my priorities should be. Where are these mythical developers who get to choose how long to spend on optimising working code without any financial imperatives? Outside of hobby projects there's always someone counting the pennies.

Re: Improving Angular performance with 1 line of code

#100

As someone who's specialized in AngularJS optimization [0], this doesn't surprise me in the least. Developers leave plenty of performance optimizations on the table, some worse than this one. The truth of the matter is that in the general case, it doesn't matter. We engineers like to go on and on about this or that perf efficiency but most of the time the code runs fast enough (and the majority of the time when it do…

>>The truth of the matter is that in the general case, it doesn't matter. We engineers like to go on and on about this or that perf efficiency but most of the time the code runs fast enough THIS! This is why battery life on mobile sucks everyone who thinks this way is the reason . As everything moves to the web, the performance of your code matters . So what if my phone has just enough CPU to render your site? You sh…

Hopefully in the future browsers will show bandwidth and energy use per domain.
Post reply on HN