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

[BUGFIX beta] Avoid allocating a binding map in meta when possible #12939

Merged
merged 1 commit into from
Feb 9, 2016

Conversation

mmun
Copy link
Member

@mmun mmun commented Feb 9, 2016

Before this PR, the connectBindings phase of Ember.Object creation would call meta.clearBindings() on every single object. This causes an extra EmptyObject to be allocated for every Ember.Object. The worst part is that it is never used on instances.

This change works around the issue making clearBindings simply setting _bindings to undefined in meta. We could likely remove this field completely if we had separate Meta classes for instances and classes.

@stefanpenner
Copy link
Member

Good catch, bugfix beta ? Or should this ride the canary train.

@mmun
Copy link
Member Author

mmun commented Feb 9, 2016

Should be completely safe to do that. Even if we did use the binding map on instances, calling metal.writeBindings(...) would create the map if it were undefined. There's no point in eagerly instantiating on clear.

@mmun mmun force-pushed the avoid-alloc-meta-bindings-map branch from 5c8c290 to 6c8b6bc Compare February 9, 2016 20:41
@mmun mmun changed the title Avoid allocating a binding map in meta when possible [BUGFIX beta] Avoid allocating a binding map in meta when possible Feb 9, 2016
@stefanpenner
Copy link
Member

There's no point in eagerly instantiating on clear.

👍

@stefanpenner
Copy link
Member

@mmun I have noticed many related issues to this over time, thanks for also adding a test. I MUCH suspect more low hanging fruit like this is present.

stefanpenner added a commit that referenced this pull request Feb 9, 2016
[BUGFIX beta] Avoid allocating a binding map in meta when possible
@stefanpenner stefanpenner merged commit f268411 into master Feb 9, 2016
@mmun mmun deleted the avoid-alloc-meta-bindings-map branch February 9, 2016 21:21
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