Skip to content

Tests are slow #399

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

Closed
davidaurelio opened this issue Mar 18, 2015 · 2 comments · Fixed by #416
Closed

Tests are slow #399

davidaurelio opened this issue Mar 18, 2015 · 2 comments · Fixed by #416

Comments

@davidaurelio
Copy link

The test suite runs rather slow, and I was wondering whether it is possible to speed it up.

I’ve tested different variants on MBPs from 2010 and 2008 (sorry, don’t have more recent hardware available atm):

CPU current state no typescript jasmine instead of jest, no typescript
Core2Duo 4m20.332s 0m51.636s 0m27.554s
i7 (2010) 2m1.904s 0m24.786s 0m23.579s
  • The biggest offender is TypeScript, so the first question is: Do the tests really need to use typescript?
  • The QuickCheck-style tests (with jasmine-check) take their time. I think it might be worth considering moving those to a separate suite. That way, there’d be a really fast running test suite that gives quick feedback (< 5 seconds) during development, and the jasmine-check-suite that can be run on occasion and by CI.
  • I don’t know why jest is slow on old hardware, but I guess that matters only to me when working on my ancient machine.
@robertknight
Copy link

I had a look at this. I don't think the problem is TypeScript inherently but the way it is being used. The current version of the compiler can compile all the .ts files in the test suite in ~2.3s on my i5 system, whereas the whole test suite takes about >100s to run.

There is a general issue on Jest's issue tracker at jestjs/jest#116 about performance. I haven't looked into that closer so I can't say how much of that is relevant.

robertknight pushed a commit to robertknight/immutable-js that referenced this issue Mar 26, 2015
Speed up the test suite by updating to the current version
of the TypeScript compiler which is ~5x faster than the 1.0
version that was being used previously and caching compiled
TypeScript files.

 * Update type definitions and flatten.ts for compatibility
   with TS 1.4
 * Remove ts-compiler dependency and use the now-public TypeScript
   compiler API directly.

Fixes immutable-js#399
@leebyron
Copy link
Collaborator

After @robertknight's diff, tests run 3x faster on travis-ci, which uses jest's inline mode. It's closer to 4-5x faster on my MPB. Still on the order of tens of seconds, but much better than the > minute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants