-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Conversation
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.
- 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'; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
42674ce
to
4dcb83d
Compare
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