-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Drop EmptyObject and use Object.create(null) again #15001
Comments
We have discussed previously and I believe we are 👍 . |
@bmeurer sounds great. This was totally just added as work around. I am slightly nervous about performance on older androids but.... may be time? |
@bmeurer in the past, we also found forcing some of our objects into dictionaries sooner yielded some improvements. Is this something we should continue? https://github.com/emberjs/ember.js/blob/master/packages/ember-utils/lib/dictionary.js#L8-L18 Or should we discontinue. @bmeurer We also worked around the cost of |
@stefanpenner The As for older Android: Chrome is ever-green, so it'll update. For the other Chromium-based Android browsers, there's not a lot we can do unfortunately, and many of them are still at V8 4.x, where the new Ember code will probably perform poorly anyway. Not sure if you do performance tracking for those old versions. |
Work for me, any day except for Wednesday (my evening, thursday your morning) works for me. I'll ping you on hangouts |
added patch for ember-data: emberjs/data#4854 |
Note that as we speak we're also adding support for |
After V8 5.6, using Object.create(null) directly is now faster than using a constructor. Refs: emberjs/ember.js#15001 Refs: https://crrev.com/532c16eca071df3ec8eed394dcebb932ef584ee6
After V8 5.6, using Object.create(null) directly is now faster than using a constructor for map-like objects. PR-URL: nodejs#11930 Refs: emberjs/ember.js#15001 Refs: https://crrev.com/532c16eca071df3ec8eed394dcebb932ef584ee6 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
@bmeurer allocation seems to be 5/6x slower on current Node.js (v7.7.4 - V8 5.5) and Node.js master (V8 5.7).
It's the same when enabling the TurboFan compiler.
|
@lpinca You probably didn't measure it's use as a dictionary. If you also include that, then |
@bmeurer I was only measuring how much it takes to create the object as we are thinking about reverting the change in Node.js (see nodejs/node#11930 (comment)) for this reason which is unfortunate. |
@lpinca Yap, the allocation is only inlined into TurboFan, and as such escape analysis can only remove the allocation in TurboFan. But an |
It seems that
new EmptyObject
was added as a work-around forObject.create(null)
performance. This has a couple of drawbacks for Ember itself, but also comes with a performance penalty in recent Chrome versions (i.e. in all current channels) that include this CL.From what I can tell,
new EmptyObject
is often used to create objects that are supposed to be used as dictionaries. But at least in V8 function constructors always create fast mode objects, which means Ember probably wastes (metadata) memory in the browser plus time just to let the engine figure out that it should essentially transition these objects to dictionary mode objects.Object.create(null)
always creates a dictionary mode object from the start (since the aforementioned CL landed), and it's compatible withjQuery.isPlainObject
and other stuff. The allocation is roughly on par with the performance ofnew EmptyObject
in all current Chrome channels.So I'd like to trigger a discussion to get rid of
EmptyObject
./cc @krisselden @stefanpenner
The text was updated successfully, but these errors were encountered: