Node: Severe performance regression with object spread operator introduced in v12.18.1 and v14.5.0

Created on 12 Jul 2020  路  10Comments  路  Source: nodejs/node

  • Version: v12.18.1, v12.18.2, v14.5.0
  • Platform: Linux lalala-nb 5.7.7-arch1-1 #1 SMP PREEMPT Wed, 01 Jul 2020 14:53:16 +0000 x86_64 GNU/Linux
  • Subsystem: v8

What steps will reproduce the bug?

When using the object spread operator to "join" two objects, the performance has decreased by ~ factor 20. This only happens with objects that have at least 50 keys and the keys of the first one need to be non trivial.

see:
https://github.com/uwinkelvos/node_object-spread_preformance-regression

If i had to guess it's related to:
https://github.com/nodejs/node/commit/af95bd70bd8ddb723107f6b2777423711f2e98ad#diff-ff06109b32824fc20fec697f584a42e3

How often does it reproduce? Is there a required condition?

Always reproducible on aforementioned platforms.

What is the expected behavior?

performance level like 12.18.0

What do you see instead?

factor 20 performance loss.

Additional information

https://bugs.chromium.org/p/v8/issues/detail?id=10763

V8 Engine performance

Most helpful comment

I'm working on this on the side, currently these are just cleanup CLs to pave the way for a proper fix.

All 10 comments

You might want to report this at https://bugs.chromium.org/p/v8/issues/list as well.

agreed

Hey! I was out for two weeks, but you are right of course. Created a v8 issue: https://bugs.chromium.org/p/v8/issues/detail?id=10763

Confirmed it's caused by 78eb420fed154b7729283a3d63c99fa9989ffbea.

https://github.com/nodejs/node/commit/78eb420fed154b7729283a3d63c99fa9989ffbea was introduced to fix https://github.com/nodejs/node/issues/32049... however it caused regressions of its own. What should we do?

cc @nodejs/tsc @nodejs/v8

The overhead here seems worse than #32049, correct? I wonder which regression our users are more likely to hit (although we have no way of knowing it for sure). The best thing would be to cherry-pick a fix as soon as one is available upstream, but until then we might want to consider reverting https://github.com/nodejs/node/commit/78eb420fed154b7729283a3d63c99fa9989ffbea.

Btw. there has been some progress on the upstream bug which is alread on _main_ branch. I have not tested the changes though.

I'm working on this on the side, currently these are just cleanup CLs to pave the way for a proper fix.

Ah, alright! Thanks for the work and the update!

Acmeair benchmark have ~40% degradation on my end because of https://github.com/nodejs/node/commit/78eb420fed154b7729283a3d63c99fa9989ffbea, you can also see the effect here, and it affect v14.5 onward as well.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nicolo-ribaudo picture nicolo-ribaudo  路  147Comments

mikeal picture mikeal  路  197Comments

silverwind picture silverwind  路  113Comments

mikeal picture mikeal  路  90Comments

VanCoding picture VanCoding  路  204Comments