Closed
Description
- Version: 12.16.1
- Platform: Linux; OSX
- Subsystem: V8
What steps will reproduce the bug?
The following code became slightly slower going from v12.15.0 to v12.16.1 (likely 12.16.0).
'use strict';
const NUM_METHODS = 250;
const ITERATIONS = 10000;
const obj = {};
for (let i = 0; i < NUM_METHODS; ++i) {
obj[`item${i}`] = {};
}
console.time();
for (let i = 0; i < ITERATIONS; ++i) {
const res = Object.assign({}, obj); // { ...obj } performs worse by a similar margin
}
console.timeEnd();
Additional information
I'm still not 100% sure this accounts for all of the slowdowns while looping through object keys that I'm seeing and I'm working on a further reduced test case, but the results here are very consistent.
Adding more items into the object makes things slower, seemingly linearly.
Note that this is quite similar to #31961, however the fix on master in 3d894d0 resolves #31961, but not this issue.