Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance issues after Babel 6 upgrade #351

Closed
vadimdemedes opened this issue Dec 22, 2015 · 9 comments
Closed

Performance issues after Babel 6 upgrade #351

vadimdemedes opened this issue Dec 22, 2015 · 9 comments
Labels
bug current functionality does not work as desired priority

Comments

@vadimdemedes
Copy link
Contributor

Since babel 6 upgrade the performance is seriously ****ed up. Using master branch and the following test file:

var test = require('./');

test('wow', t => {
    t.true(true);
});
$ time ava example.js
ava example.js  4.04s user 0.39s system 101% cpu 4.344 total

Running it for like 10th time and getting the same results.

Would be great if someone else confirmed this.

@sindresorhus
Copy link
Member

Confirmed.

~/dev/ava master*
❯ time ava example.js

  ✔ wow

  1 test passed


real    3.46s
user    3.21s
sys 0.32s

@sindresorhus sindresorhus added bug current functionality does not work as desired priority labels Dec 22, 2015
@sindresorhus
Copy link
Member

If I run npm dedupe and then try again, it's faster.

❯ time ava example.js

  ✔ wow

  1 test passed


real    1.40s
user    1.30s
sys 0.14s

@sindresorhus
Copy link
Member

Babel 6 is a lot more modular, so that might be where all the overhead comes from. Using npm@3 would also be faster (since it dedupes by default).

@vadimdemedes
Copy link
Contributor Author

Then we are stuck with initial delay on every test run. Not good.

@vadimdemedes
Copy link
Contributor Author

I think the solution to this is to cache babel's output. There already was some development in that direction in #189, but left incomplete.

My proposal is to cache transformed code based by md5 of original source code. That way, we don't even need to require('babel'), when test files don't change. When md5 changes, load babel and re-transpile source code.

This should improve performance.

@jamestalmage
Copy link
Contributor

using npm 3

That is basically a requirement of Babel 6. npm dedupe is the only other option.

caching

I just finished implementing much the same for nyc with very good results. It's part of my plan after I land #349

@vadimdemedes
Copy link
Contributor Author

Seems like #349 will take good amount of time. I can implement cache now and send a quick PR, so that we can do a release with babel 6 within next few days.

@sindresorhus
Copy link
Member

This can be closed now, right?

@vadimdemedes
Copy link
Contributor Author

Yep, #352 got it covered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug current functionality does not work as desired priority
Projects
None yet
Development

No branches or pull requests

3 participants