@babel/plugin-transform-classses(createSuper)@7.9.x may have performance issue
See original GitHub issueClasses with super class are very slow to new
, in comparison to what babel@7.8.8 does. The difference can be found at here.
function test(Vec3) {
const t1 = Date.now();
(() => {
for (let i = 0; i < 1000000; ++i) {
const x = Math.random();
new Vec3(x, x, x); // Key line
}
})();
const t2 = Date.now();
console.log(`Past: ${t2 - t1}ms`);
}
test(require('./out/7.8.8/vec3.js').Vec3); // 18ms
test(require('./out/7.9.x/vec3.js').Vec3); // Oops, 2451ms!!
I have upload the test code to this repository. You can try it just by node ./run-perf.js
.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:7
- Comments:16 (14 by maintainers)
Top Results From Across the Web
No results found
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’d be ok with a
assumeNoExtendNative
option to the classes plugin.It’s because with
new
you can’t specify the third parameter ofReflect.construct
(new.target
).