question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

@babel/plugin-transform-classses(createSuper)@7.9.x may have performance issue

See original GitHub issue

Classes 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:closed
  • Created 3 years ago
  • Reactions:7
  • Comments:16 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
nicolo-ribaudocommented, Jun 1, 2020

I’d be ok with a assumeNoExtendNative option to the classes plugin.

1reaction
nicolo-ribaudocommented, Apr 2, 2020

It’s because with new you can’t specify the third parameter of Reflect.construct (new.target).

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found