Model Change Detection: Object.observe Polyfill vs Angular Dirty Checking

97 views
Skip to first unread message

santiago esteva

unread,
Oct 3, 2014, 9:11:13 AM10/3/14
to ang...@googlegroups.com
Im wondering if anybody has done any benchmarking on polymer polyfill and angular dirty checking when it comes to model change detection.

Are these two performance checks 'apples to apples'?

If I combine those two jsperf exercises, the results are absurd! http://jsperf.com/model-detection-polymer-vs-angular

Sander Elias

unread,
Oct 3, 2014, 10:09:21 AM10/3/14
to ang...@googlegroups.com
Hi Santiago,

You are comparing entirely different things. 
In the angular part, you force a $digest., and the polymer part you are just calling the task that does the watching.
basically you compare a full update with a check that checks if there is a need to do a more comprehensive test. and that later one might update the UI.
There happens a lot under the hood in both frameworks. Both have their strengths and weaknesses. 
I doubt that when you compare a real application in both, there will be a large difference in performance. 
And do not forget, AngularJS is in production, while Polymer is in developer preview. I'm not sure what that means, but I suspect that's not even in beta ;)

Regards
Sander



santiago esteva

unread,
Oct 3, 2014, 10:14:27 AM10/3/14
to ang...@googlegroups.com
Thank you! Thats what I thought. Im trying to compare object.observe polyfill dirty checking method with angular dirty checking method. I would appreciate your feedback on to update the test to make it apples to apples.

santiago esteva

unread,
Oct 3, 2014, 12:58:11 PM10/3/14
to ang...@googlegroups.com

--
You received this message because you are subscribed to a topic in the Google Groups "AngularJS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/angular/Wby9nDFbO6U/unsubscribe.
To unsubscribe from this group and all its topics, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

santiago esteva

unread,
Oct 6, 2014, 2:34:58 PM10/6/14
to ang...@googlegroups.com
In this comparison the both frameworks need to register a watcher/observer and then the model is updated.
I can see how dirty checking when using polyfills is head to head in some browsers.


Let me know what you think.


On Friday, October 3, 2014 9:09:21 AM UTC-5, Sander Elias wrote:

Sander Elias

unread,
Oct 7, 2014, 3:01:35 AM10/7/14
to ang...@googlegroups.com
Hi Santiago,

This is still comparing apples to oranges.

  1. PathObserver has some similarity with a $watch, but is still something entirely different.
  2. Platform.performMicrotaskCheckpoint() and $digest are also not the same.
  3. in your angular part, you are doing a lot more. (You are calling the injector every time. In polymer this would be the same as loading the platformJS before every operation (see I can do apples and oranges too :) ))
  4. you are microbenchmarking a tiny part of both, with a benchmark that has no real world application value
If you want to really look at the performance of both, take an app, and write it in both, put in a couple of measurable points, and benchmark them.
Like time for the app to become responsive (most cases, angular will win this one now)
Measure it takes to complete an user action (for example, add/delete an item in a todo-list) This is the most interesting metric of all, an will be a close call in most cases.
You also should look at the time it takes to build and refine both applications. Programmer efficiency is also a very important metric.

Regards
Sander Elias 



Reply all
Reply to author
Forward
0 new messages