Ember.computed.oneWay performance


Could it be that Ember.computed.oneWay or Ember.computed.readOnly is noticeably slower than a ‘normal’ computed property? I mean, I notice this:

someProperty: (function() {this.get('other');}).property('other')

is more performant than:

someProperty: Ember.computed.oneWay('other')

Is there any difference in the two version that can explain what I’m seeing?


oneWay and readOnly take a very difference code path from a computed property. They are some kind of aliases, that is, when you get/set a oneWay, readOnly or alias property, the call reaches the property, and then is redirected and retried with the alias target instead.

Your property on the other hand is cached, and the value is returned directly from cache. So I see how it could be faster. It would seem logical also that your property slows down the setting of other more.

If you’re planning on building some benchmark for this, I’d be curious to know the performance impact of both methods.

Thanks! I didn’t know oneWay doesn’t cache… Why not?

I don’t know the exact reason. I guess that’s just the way it was designed, oneWay is a one way alias, not a computed property.