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 release] restore internalModels GUID_KEY’s #4922

Merged
merged 1 commit into from
Apr 12, 2017
Merged

Conversation

stefanpenner
Copy link
Member

@stefanpenner stefanpenner commented Apr 12, 2017

Without this, adding an internalModel to an orderd set will result in a new [GUID_KEY] prop being added, but using defineProperty https://github.com/emberjs/ember.js/blob/master/packages/ember-utils/lib/guid.js#L187. Both causing a shape change, and a potentially costly defProp.

Restoring this restores that, and addresses a category of OrderdSet related performance issues.

@rwjblue / @runspired

stefanpenner referenced this pull request Apr 12, 2017
In future versions of Ember, the `Ember.GUID_KEY` property may not be the place that guids are stored per object (may be moving to a `WeakMap`).  This change keeps `this[GUID_KEY]` around for easier debugging (though it isn't _required_ per-se), and uses `Ember.guidFor` to get the guid and setup the object.
stefanpenner referenced this pull request Apr 12, 2017
- allocations are now lazy
- InternalModel is now an ES2015 class, the expensive classCallCheck is stripped via a babel plugin
- TransitionMapCache has been added to make transitionTo function faster
- get/set of currentState has been moved to dot notation access
- overall this appears to be a 20% perf improvement, with more gains still realizable.
this._internalId = InternalModelReferenceId++;

// this ensure ordered set can quickly identify this as unique
this[Ember.GUID_KEY] = InternalModelReferenceId++ + 'internal-model';
Copy link
Member Author

@stefanpenner stefanpenner Apr 12, 2017

Choose a reason for hiding this comment

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

Was originally added as part of making stuff faster: ca9393f

Left a comment to hope it survives this time

Copy link
Contributor

Choose a reason for hiding this comment

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

The comment will help this survive a lot better, the assumption before was that this shaping was to help the cases where internalModel was being abused by DS.Model (no longer is), meta, computeds and other public interface things.

Copy link
Member Author

Choose a reason for hiding this comment

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

understood, the secret handshake this is doing is not obvious at all. Im not surprised it was lost.

@bmac bmac merged commit 7bfadcd into master Apr 12, 2017
@bmac bmac deleted the restore-guid-key branch April 12, 2017 19:17
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.

3 participants