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

RFC: Performance report for each ts-jest version #1115

Open
SLKnutson opened this issue May 31, 2019 · 21 comments
Open

RFC: Performance report for each ts-jest version #1115

SLKnutson opened this issue May 31, 2019 · 21 comments

Comments

@SLKnutson
Copy link

SLKnutson commented May 31, 2019

Topic

This is a discussion issue where users can report any regressions in performance. All the reported cases will be taken care of with high priority.

Helpful solutions for performance improvement:

Follow updated information in documentation at https://kulshekhar.github.io/ts-jest/user/config/isolatedModules

@ahnpnl ahnpnl added the Performance Severe performance issue label Jan 13, 2020
@ahnpnl ahnpnl changed the title isolatedModules=false ruins performance on large projects on windows Performance downgrades after 23.10 Jan 13, 2020
@mockdeep
Copy link

For what it's worth, isolatedModules=true didn't solve the problem for us, nor did setting --maxWorkers=1. We haven't been able to upgrade past version 23 because our build times out due to inactivity. It seems like the specs start out reasonably fast and gradually get slower and slower. When we run Typescript separately it runs relatively quickly. Is there no way to run it up front and use the compiled output? Haven't had a chance to try @babel/preset-typescript, but that's next on our list.

@ahnpnl
Copy link
Collaborator

ahnpnl commented Jan 13, 2020

These are the 2 things I did for CI at work:

  • set isolatedModules=true and clear jest cache then perform a dry run. After this run, jest and ts-jest will cache stuffs which will speed up for the next runs.
  • run with maxWorkers=1 or maxWorkers=50%.

They are affected, only the 1st time it takes time because of clearing cache (set isolatedModules from false to true requires clear cache to be affected).

Alternatively, you can use the combo of tsc and babel on compiled js. tsc will take care of type checking and jest will run on js using babel.

@ahnpnl
Copy link
Collaborator

ahnpnl commented Apr 21, 2020

#1549 will be in alpha version today. Please test and let us know whether it helps.

@vkrol
Copy link

vkrol commented Apr 23, 2020

@ahnpnl

#1549 will be in alpha version today. Please test and let us know whether it helps.

We have some problems with d.ts files https://github.com/vkrol/ts-jest-25.5.0-alpha.0-custom-typings.

@ahnpnl
Copy link
Collaborator

ahnpnl commented Apr 24, 2020

@ahnpnl

#1549 will be in alpha version today. Please test and let us know whether it helps.

We have some problems with d.ts files https://github.com/vkrol/ts-jest-25.5.0-alpha.0-custom-typings.

thanks @vkrol , it will be fixed by #1562

@ahnpnl
Copy link
Collaborator

ahnpnl commented Apr 29, 2020

25.5.0-beta.0 was released.

@zakhenry
Copy link

zakhenry commented May 5, 2020

@ahnpnl I can confirm this beta has a massive performance improvement for us (down to 37 minutes from 5.5 hours with cold cache) 🎉

@ahnpnl
Copy link
Collaborator

ahnpnl commented May 5, 2020

@ahnpnl I can confirm this beta has a massive performance improvement for us (down to 37 minutes from 5.5 hours with cold cache) 🎉

I'm very glad to hear that 👍

@ahnpnl
Copy link
Collaborator

ahnpnl commented May 9, 2020

related to this topic. 25.5.1 is out which reverted the changes to boost performance in 25.5.0 because it created so many inconveniences for users.

Therefore, ts-jest has added to doc the instruction for users to boost performance in Performance section https://kulshekhar.github.io/ts-jest/user/config/isolatedModules

@ahnpnl ahnpnl changed the title RFC: Performance with isolatedModules: false with ts-jest@next RFC: Performance report for each ts-jest version Jul 4, 2020
@ahnpnl ahnpnl removed Help Wanted Performance Severe performance issue labels Jul 4, 2020
@ahnpnl
Copy link
Collaborator

ahnpnl commented Jul 14, 2020

Hi folks 👋 a few extra improvements for this topic were introduced in v26.1.2 . Would love to hear some feedbacks from you guys 🙏

@ahnpnl
Copy link
Collaborator

ahnpnl commented Aug 3, 2020

isolatedModules: true isn't in the scope of this one :) this one is only about isolatedModules: false

@romua
Copy link

romua commented Aug 3, 2020

isolatedModules: true isn't in the scope of this one :) this one is only about isolatedModules: false

sry)

@MaRuifeng
Copy link

I am not getting anywhere closer towards a good performance with v26 above. Still the old trick of setting isolatedModules=true and running with maxWorkers=1 works a bit.

@m-thompson-code
Copy link

related to this topic. 25.5.1 is out which reverted the changes to boost performance in 25.5.0 because it created so many inconveniences for users.

Therefore, ts-jest has added to doc the instruction for users to boost performance in Performance section https://kulshekhar.github.io/ts-jest/user/config/isolatedModules

Link doesn't work ):

@ahnpnl
Copy link
Collaborator

ahnpnl commented Oct 14, 2021

https://kulshekhar.github.io/ts-jest/docs/getting-started/options/isolatedModules

@dsmalik
Copy link

dsmalik commented Apr 10, 2022

Hey @ahnpnl , after reading about isolatedModules it is clear why it would improve performance but docs also mention about using jest with --no-cache option. Can you share some thoughts on how the --no-cache option helps with performance when used with isolatedModules=true

If taking in a little more detail, In our projects we have identified the performance bottleneck to be the usage of barrel imports. Although we are still on v24.x.x, in an ongoing effort to upgrade to v25/v27, didnt notice any significant performance improvement. The project is big with around 15k files.
On CI agents, when running in band with isolatedModules=false, they complete in around 3hrs but using isolatedModules=true taken more than 4hrs. Havent tried much experiment using --no-cache option but when tried last time, that didnt work as well so any thoughts on how this option affects performance will help.

@ahnpnl
Copy link
Collaborator

ahnpnl commented Apr 10, 2022

--no-cache doesn't help with performance, the docs is wrong about it.

We plan to switch to esbuild or swc in the next major release. That would help to solve all the performance issues.

@Smoczysko
Copy link

@ahnpnl Is there any loose timeline for when this might happen?

@motin
Copy link

motin commented May 19, 2022

This may be relevant to evaluate how much faster your tests may be once ts-jest switches or to swc:

To make your Jest tests run faster, you can swap out the default JavaScript-based runner (ts-jest) for a drop-in Rust replacement using SWC.

@alloy
Copy link

alloy commented May 24, 2022

@ahnpnl One bit of feedback to perhaps consider between esbuild and swc is that the latter has first-class support for custom AST transforms.

@treefitty
Copy link

@ahnpnl just thought i'd note that changing to esbuild brings it's own set of challenges with some dependent projects (typeorm) in our case as their speed benefits come at the cost of some language features

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

No branches or pull requests