|
|
|
|
|
by Waterluvian
1209 days ago
|
|
This is delightful! Maybe next you can make the object spread operator faster ;). I was recently bitten by it in a hot loop, thinking it was generally syntactic sugar. Turns out that if I know all the property names in an object, it’s far far faster to just assign them all manually. |
|
BTW. I recently measured the spread operator in a microbenchmark. Interestingly, while the native spread was faster on Hermes and JSC, it was slower on V8/Chrome, and it's faster there to use `Object.assign()`, i.e.:
['@babel/plugin-proposal-object-rest-spread', { loose: true, useBuiltIns: true }]