Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access property only once during Ember.get #12485

Merged
merged 1 commit into from
Oct 16, 2015

Conversation

trentmwillis
Copy link
Member

Inside of Ember.get, there are cases where the property on an object will get accessed more than once for a single call. In most cases this isn't a problem, but if the object has a getter defined on it then we wind up doing extra work and incurring a performance hit.

@trentmwillis trentmwillis changed the title Access property only once during property get Access property only once during Ember.get Oct 15, 2015
@@ -76,10 +76,10 @@ export function get(obj, keyName) {
if (meta && meta.peekWatching(keyName) > 0) {
ret = meta.peekValues(keyName);
} else {
ret = obj[keyName];
ret = possibleDesc;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

var name should be different, as in this position (and bellow) it actually cannot be a descriptor any-longer.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Preference on the new name? value? keyValue?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

value SGTM

@trentmwillis
Copy link
Member Author

I think the CI may need to be re-run. Says tests failed on two version of IE, but the failures are related to the visit API.

stefanpenner added a commit that referenced this pull request Oct 16, 2015
Access property only once during `Ember.get`
@stefanpenner stefanpenner merged commit 08d7949 into emberjs:master Oct 16, 2015
@stefanpenner
Copy link
Member

thanks @trentmwillis, this is a nice cleanup. I would love for us to continue to tighten up these internals.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants