News for hackers. Stuff that matters.
Re:Backbone Events vs. Ember Bindings: A Benchmark by Lazare on Tuesday February 21, 2012 @05:39PM (#3618339)
In case anyone cares, here's a jsfiddle for KnockoutJS: http://jsfiddle.net/2pLk3/5/

I was curious how it would stack up - the answer seems to be "pretty well, actually". Of course, all the normal warnings about synthetic benchmarks apply. :)

Edit: I'm updated the JSFiddle to attempt to properly clean up the Knockout bindings. Probably. As I said, I'm pretty new to Knockout still, and may well have made a mistake.

Re:Backbone Events vs. Ember Bindings: A Benchmark by krosaen on Tuesday February 21, 2012 @09:13PM (#3619060)
Thanks for this - I always wonder why knockout doesn't get more attention on hacker news, it's really great and seems to meet the same needs as ember. Plus, their tutorials are awesome:

http://learn.knockoutjs.com

Re:Backbone Events vs. Ember Bindings: A Benchmark by jashkenas on Tuesday February 21, 2012 @05:42PM (#3618352)
Looks great -- but you need to clean up the knockout bindings when clicking a button again. After a few clicks, it gets slower and slower... Also affects which button you click first.
Re:Backbone Events vs. Ember Bindings: A Benchmark by Lazare on Wednesday February 22, 2012 @09:36AM (#3620977)
Feh. As multiple people have kindly pointed out to me, I had a silly typo in my code and was accidentally clobbering the ko.computed function. The updated jsfiddle is here: http://jsfiddle.net/2pLk3/18/

Embarrassing. :)

Re:Backbone Events vs. Ember Bindings: A Benchmark by schinckel on Wednesday February 22, 2012 @06:06AM (#3620379)
You are not actually using ko.computed objects in your fiddle.

My take on it: http://jsfiddle.net/HusVw/1/

And guess what, it's _much_ slower. (And I'm a happy KO user).

Re:Backbone Events vs. Ember Bindings: A Benchmark by krosaen on Wednesday February 22, 2012 @09:46AM (#3621016)
There's some discussion on the ko google groups about this :

https://groups.google.com/forum/?fromgroups#!topic/knockoutj...

you are right, the correct version is perhaps slightly faster than the ember, but way slower than the backbone example.

However, by leveraging an optimized ko.computed implementation

http://mbest.github.com/knockout-deferred-updates/

the results are much more impressive.

http://jsfiddle.net/2pLk3/10/

Re:Backbone Events vs. Ember Bindings: A Benchmark by Lazare on Wednesday February 22, 2012 @07:14PM (#3623185)
I'm don't agree that that the version with unused intermediate computed observables is the only correct version (or that there even is only one correct version).

Avoiding the use of intermediate computeds makes the Knockout version roughly as fast as Backbone for this specific benchmark, and more closely replicates the functionality of the Backbone example. That sounds like the correct version to me.