-
Notifications
You must be signed in to change notification settings - Fork 27
Call with V8 team #62
Comments
|
cc @ofrobots |
Would be really interested to hear feedback for |
@cjihrig @Trott Why do we think its slower than |
I think every time someone benchmarked the two,
People have reported seeing EDIT: A benchmark was provided in nodejs/node#7255. |
Here are two different benchmarks with conflicting results. So which one is faster may depend on your use case. Here's the one showing `util._extend()` being faster.Here is a slightly modified version of a benchmark originally written by @jasnell. Code'use strict';
const common = require('../common');
const util = require('util');
const bench = common.createBenchmark(main, {
method: ['Object.assign()', 'util._extend()'],
size: [5, 10, 15, 30],
n: [1e5]
});
function makeObject(size) {
var m = {};
for (var n = 0; n < size; n++)
m[`key${n}`] = n;
return m;
}
function useObjectAssign(n, obj) {
bench.start();
for (var i = 0; i < n; i++) {
Object.assign({}, obj);
}
bench.end(n);
}
function useUtilExtend(n, obj) {
bench.start();
for (var i = 0; i < n; i++) {
util._extend({}, obj);
}
bench.end(n);
}
function main(conf) {
const n = +conf.n;
const obj = makeObject(+conf.size);
switch (conf.method) {
case 'Object.assign()':
useObjectAssign(n, obj);
break;
case 'util._extend()':
useUtilExtend(n, obj);
break;
default:
throw new Error('Unexpected method');
}
} Resultses/more-different-object-assign.js n=100000 size=5 method="Object.assign()": 1,250,221.8987592561
es/more-different-object-assign.js n=100000 size=10 method="Object.assign()": 631,233.9839762895
es/more-different-object-assign.js n=100000 size=15 method="Object.assign()": 370,360.6970976447
es/more-different-object-assign.js n=100000 size=30 method="Object.assign()": 91,588.78644709584
es/more-different-object-assign.js n=100000 size=5 method="util._extend()": 4,757,977.84419069
es/more-different-object-assign.js n=100000 size=10 method="util._extend()": 2,845,257.808810056
es/more-different-object-assign.js n=100000 size=15 method="util._extend()": 2,240,614.63106566
es/more-different-object-assign.js n=100000 size=30 method="util._extend()": 253,510.71525401654 Here's the one showing `Object.assign()` being faster.This is a modified version of a benchmark originally written by @suryagh. Code'use strict';
const common = require('../common.js');
const util = require('util');
const bench = common.createBenchmark(main, {
n: [1, 10, 100, 1000],
method: ['_extend', 'assign']
});
const methods = {
'_extend': util._extend,
'assign': Object.assign
}
function main(conf) {
const n = +conf.n;
const method = methods[conf.method];
const target = {};
bench.start()
for (var i = 0; i < n; i++) {
method(target, {i: i});
}
bench.end(n)
} Resultses/object-assign.js method="_extend" n=1: 11,816.559726801139
es/object-assign.js method="assign" n=1: 13,891.590031394993
es/object-assign.js method="_extend" n=10: 73,593.80634525798
es/object-assign.js method="assign" n=10: 74,392.03112562583
es/object-assign.js method="_extend" n=100: 646,663.2177961718
es/object-assign.js method="assign" n=100: 716,707.1606212418
es/object-assign.js method="_extend" n=1000: 2,613,279.116502596
es/object-assign.js method="assign" n=1000: 3,053,313.914256839 |
they're different tests -- one copies an object with 10,15,30 fields, the other |
Yes, I probably shouldn't have said "conflicting". I didn't mean "contradictory" or "paradoxical" or anything like that. I just meant what results you get depend on what you're testing. Although I guess I should also add that the one showing |
cc @verwaest who did the |
I was just playing with this a bit earlier this week. |
I can confirm the above, _extend is 2-5x faster. The exceptions are the Also, there is an order of magnitude speed difference between copying objects E.g., extend/assign relative rates for an object with 10 properties: (Unrelated, but surprisingly _extend reverses the order of the properties; |
There is definitely still room for improvement in Object.assign. We'll
should to look into it again sometime soon.
OTOH you have to be careful with microbenchmarks for hand rolled versions
because they may look fast in isolation but won't always give good perf
when used in an application. They will quickly really on a shared cache
that only starts conflicting when there are other users as well.
Object.assign doesn't have that issue.
…On Thu, Jan 19, 2017, 20:03 Andras ***@***.***> wrote:
I can confirm the above, _extend is 2-5x faster. The exceptions are the
empty object {} (assign 2x faster) and objects with a single property (30%
faster),
and object whose property names are numeric strings. The last two are why
the test that copies properties singly favors assign.
Also, there is an order of magnitude speed difference between copying
objects
whose properties are indexed by numeric strings "123" vs words "a123"
(indexing by words up to 12x faster), but this has to be due to v8
internals.
The speed to copy gradually slows for large numeric values up to 4 billion
(2^32);
above 2^32 numeric strings run as fast as words. This quirk can bias
benchmarks.
E.g., extend/assign relative rates for an object with 10 properties:
property names numeric strings '0' .. '9':
extend: 1.00x
assign: 1.25x
property names '1230' .. '1239':
extend: 1.18x
assign: 0.90x
property names '4000000000' ... '4000000009':
extend: 0.45x
assign: 0.80x
property names words 'a0' .. 'a9':
extend: 12x
assign: 1.9x
(timed with node-v7.4.0)
(Unrelated, but surprisingly _extend reverses the order of the properties;
_extend({}, {a:1, b:2}) yields the unexpected {b:2, a:1}.)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#62 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AASgHlve2POgC9NwuTk2LmGBd5lc5p-gks5rT7OFgaJpZM4Ll2Fv>
.
|
I think the discussion on Object.assign is potentially interesting, but it seems that it has hijacked the original intent of this issue. I do think it would good to have a call w/ the V8 team. Any interest from the CTC on that? As for logistics, since most of the V8 team is Central European time-zone, perhaps the standard CTC afternoon Europe / morning Pacific time slot could work, but on a different day? |
o/
That would be the 16:00 UTC time which (depending on daylight savings status) is 8am PST, 9am PDT, 5pm CET, and 6pm CEST. (For anyone who cares: Confusingly, the "S" in PST means "standard" so that's the time in winter as compared to "daylight savings" time in summer. The "S" in CEST is for "summer" so it's basically the opposite of the "S" in PST.) |
5pm CET and later generally work well for me. |
I'd be interested. |
I think all that's needed at this point is someone willing to do the logistical work: possibly a Doodle poll, definitely schedule a time, probably put together an agenda...that's probably about it. Decisions like Hangout vs. Uberconference etc. can be made later based on how many people are attending and who they are. |
Is this still being planned? Should we open a Doodle to find out times? |
I think all that's needed at this point is someone willing to do the logistical work: possibly a Doodle poll, definitely schedule a time, probably put together an agenda...that's probably about it. |
I've set up a doodle here: http://doodle.com/poll/r2wz2vqqr9rk925i
|
Is this open to all collaborators? I'd like to join. Thanks! |
Fewer people than I hoped actually signed up on the Doodle poll. If we want to go through with this nevertheless, I suggest doing the call on Feb 15, 10am PST. I prepared a document on the GYP issue as to get everyone on the same page for discussion: https://docs.google.com/document/d/1gvHuesiuvLzD6X6ONddxXRxhODlOJlxgfoTNZTlKLGA/edit# @natorion could you help me setting up a public Hangouts session? |
From my experience around here, 13 is a pretty nice turnout 😄 . |
Well half are from the V8 team. Talking among the V8 team is not really the goal :) |
Sorry, I somehow missed this. I added myself to the doodle, but if I'm too late, then that's ok. |
I suppose it makes most sense to make the meeting public id public and post it here? Than everybody can join easily. |
Wednesday 10am PST still winning. Making the hangout public sgtm. |
I guess discussion of gyp is a good reason to join... I expect you will be dropping the gyp files at some point? |
Added to calendar: direct event link. |
I know this is listed as CTC meeting with v8 team but I'm wondering if it would be ok if @jbajwa were to join in (possibly as an observer) as he is involved in the v8 ports to PPC and s390 in the core V8 repos and the Node.js repos. I'm asking becuse its not clear if the meeting is open to all or just CTC members. |
@mhdawson I don't really mind. Given that the GYP migration probably affects less popular platforms more than popular ones, I think it actually makes sense. |
Will this be broadcast live? or just a google hangout? I'll want to watch live or maybe after it is over if I miss it. |
I didn't set up any live streaming and I was not planning to record it. There is definitely the possibility for the latter though. |
Thanks for joining the meeting! It was very valuable to us! A few quick notes on what we discussed. Please correct me if I misunderstood anything. GYP deprecation:
Snapshot and code cache
Debug context deprecation
Misc
@ofrobots could you make the recording of the meeting available? Thanks. |
I am not sure if I can do that. Apparently we needed consent from everyone involved 😓. |
Just out of interest. What are we losing here (noting "most")? Anything that might upset people using the debugger or using it from add-ons? |
I don't have a full list of missing features. We were able to migrate all of V8's debugger tests that use the debug context to the inspector protocol, with a wrapper to emulate the debug context API. Notably missing is true mirror support. You can still do most of the things that mirrors offer, but you can't get access to the actual object you created the mirror for. That's because of the limitations of the inspector protocol. There are a few smaller features that have no inspector counter part, which are implemented as runtime functions (prefixed with %) in the wrapper. |
Since the last meeting was reasonably well-received, and we did agree on repeating it, here's the Doodle link for the next one: http://doodle.com/poll/h8td28wnzt3kdmmr @bmeurer wants to talk about performance pain points for Node. Other agenda items are welcome too. |
@hashseed what timezone is the doodle in? All I see is either 6 am or 7 am... |
@MylesBorins 6/7 am would be CET. You can change the timezone, though. See on the right: |
Thanks!
…On Wed, Mar 1, 2017 at 11:26 AM, Michaël Zasso ***@***.***> wrote:
@MylesBorins <https://github.com/MylesBorins> 6/7 am would be CET. You
can change the timezone, though. See on the right:
[image: image]
<https://cloud.githubusercontent.com/assets/2352663/23469493/0d5593ec-fea4-11e6-945e-b576951a92e8.png>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#62 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAecV3D2Wrd-OOJHhXIhu3S1TV3qYCtcks5rhZwegaJpZM4Ll2Fv>
.
|
@hashseed thanks! It might be more discoverable and easier to follow the thread if you open a new issue for the new meeting. |
I'd like to attend but the proposed times are the middle of the night for me (12/1 AM). |
Yes. These times are not ideal for everyone. I'd like to switch to other times on a follow up meeting if there is interest. But for this one let's keep the current choices. |
Just in case the other issue has low visibility: looks like March 30th, 6am CET, is the winner for the second meeting. Hangouts link. |
Let's use #76 to track the new agenda and close this one now. Thanks! |
`Object.assign` is much slower than `util._extend` according to the refs. This change is to convert the `Object.assign` to use `util._extend` in url module for improving profermance. Refs: nodejs/CTC#62
`Object.assign` is much slower than `util._extend` according to the refs. This change is to convert the `Object.assign` to use `util._extend` in url module for improving profermance. PR-URL: #16081 Refs: nodejs/CTC#62 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Brian White <mscdex@mscdex.net>
`Object.assign` is much slower than `util._extend` according to the refs. This change is to convert the `Object.assign` to use `util._extend` in url module for improving profermance. PR-URL: nodejs/node#16081 Refs: nodejs/CTC#62 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Brian White <mscdex@mscdex.net>
`Object.assign` is much slower than `util._extend` according to the refs. This change is to convert the `Object.assign` to use `util._extend` in url module for improving profermance. PR-URL: #16081 Refs: nodejs/CTC#62 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Brian White <mscdex@mscdex.net>
Hello everyone!
I think we should coordinate and schedule a joint call between Node.js CTC and V8 team to discuss following topic:
cc @nodejs/ctc @bmeurer
The text was updated successfully, but these errors were encountered: