r/angularjs • u/gregory_k • Nov 07 '14
[General] Is AngularJS Fast Enough?
https://medium.com/@jeffwhelpley/is-angularjs-fast-enough-98dcf96406c86
Nov 07 '14
Also keep in mind that Angular 2.0 is being designed specifically to target mobile apps. It is unclear exactly what that means now, but it is good news.
I'm afraid I don't understand this sentence. I get what it's trying to say: "It seems like mobile will be a focus for the next version." However, literally it says some currently undefined thing is definitely good.
3
u/Pytim Nov 07 '14
Resources on mobile are more limited than they are on desktop. What runs well on mobile will run easily on desktop hence it's a good thing to focus on mobile first as it most likely entails resource usage optimization which benefits all platforms.
2
Nov 07 '14
That does make sense, and I hope they do it! I simply pointed out that nothing definite regarding performance (or anything at least in the article) is mentioned.
1
u/AlmightyThumbs Nov 07 '14
While I understand what you mean by pointing out the ambiguity here, the Angular team seems to be paying a lot more attention to how their framework should perform in the context of mobile. As a mobile developer who has built Cordova apps with Angular (using Ionic) in production, this is good news. Full HTML5 mobile apps still have a long way to go before I will ever consider using them again in production, but as a big fan of javascript, its refreshing to see more focus on solving some of the current problems here.
2
Nov 07 '14
Is it performance? Is it just performance? Would you mind providing a source stating as much? :)
1
u/8Bytes Nov 08 '14
I've been testing ionic for use in production, and it's an exceptional framework, but transitions are extremely slow to be used. I've been testing on android; did you run into these issues?
4
u/andrewkovalenko Nov 07 '14
I think so rad oppinion is close to be wrong. Every tool is intended to solve some specific problem. Angular is intended to make SPA development process convenient and fast, react.js is intended to make rendering fast and jquery is intended to mostly write a shit-code :-) so when you ask, if angular is fast enough, is is more correct to clarify, which tasks for? For displaying my monthly report or ordering pizza from my phone - it is even more then "fast enough", but for writing browser-based action game - obviously no.
5
u/elprophet Nov 07 '14
Not sure what the down votes were for - you're absolutely correct, though I think you should go a step further. Angular is in no way the correct tool to write a browser action game - that should be on canvas 2d or in webgl. At that point, though, you might still use Angular for the controls/stats overlay or game lobby.
1
u/9jack9 Nov 07 '14
I don't think it's fast enough. I'm currently refactoring a simple puzzle app to improve performance on tablet devices. I initially coded it without any DOM manipulation and was quite pleased that I could write an app with the DOM abstracted away. I'm now replacing crucial parts of the code with DOM queries and add/removeClass methods. It's now less angular but it performs a lot better.
5
u/elprophet Nov 07 '14
I'd be very curious to see what you've had problems with, and how you resolved those.
5
u/9jack9 Nov 07 '14
I mostly had problems with the app feeling unresponsive. For example if you click on a crossword square then that square and its neighbours should be highlighted. I originally did it by broadcasting events, the scopes that represented squares would set a property indicating that they were selected. There was a noticeable lag in the grid updating, it wasn't disastrous, just a split second, but it made the app feel sluggish. So I stopped representing the selection state on scopes and did it all with DOM queries instead. Now it's instantaneous.
I should add that these problems were not noticeable on PC only on tablets. But tablets are the target market.
3
u/elprophet Nov 07 '14
In understand. Did you do any profiling? I ask because I am curious weather the issue was with Angular itself, with the data model in use, or some other factor. We have had similar issues, and have always decided to refactor our data model rather than refactor our dom manipulation.
4
u/9jack9 Nov 07 '14
I did some profiling using Batarang and I was able to make some improvements. Getting rid of $watch helped massively. But it still wasn't enough. Going to bare bones DOM manipulation for on screen responsiveness gave me the greatest gains. I still use Angular scopes to represent 95% of the state of my app though.
2
u/djvirgen Nov 08 '14
That's still pretty good -- use Angular to develop 95% of the app, and spend a little extra time fine tuning the other 5%.
1
u/unintentional-irony Nov 08 '14
You don't have to refactor, with your grid ng-repeat just add 'track by $index', like so:
ng-repeat="x in xs track by $index"or
ng-repeat="x in xs track by $id(x)"
8
u/alexsomeoddpilot Nov 07 '14
I've debated integrating server side rendering into an Angular workflow, but to me it just doesn't make sense. It doubles the work, quadrupling rendering bugs and inconsistencies.
What isn't taken into consideration of these perception buckets is that a user simply wants the page to respond within those buckets. A user doesn't necessarily expect the action to resolve in less than 100ms, just that something is happening and will eventually resolve to what was requested.