-
Notifications
You must be signed in to change notification settings - Fork 455
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
Cache support #30
Comments
I'm not sure about details of this topic, is this about utilize caching behavior of jest or have separate caching mechanism inside of ts-jest orthogonally? |
Unfortunately, as for now I have no idea how to correctly utilize jest caching, but there is a way to utilize (at least partially) cache of source-map-support for source files and implement our own cache for config files. |
: I wish there's easy way to use it too. :/ I've looked into jest's implementation if I could use it for coverage processing to avoid In my point of view ideal way to achieve caching is use jest as-is (based on assumption if possible...). In most case jest already precaches and does not hit preprocessor if code is already there. Unless writer changes significant amount of code, preprocessing won't cause performance issue in general - this removes needs of config cache in 1, 2. For case of 4, I'm bit doubt about it as reason mentioned above (jest already caches it), it'll be possibly duplicated effort to create file cache. But once again, this is all based assumption all functionality does not regresses without |
@kwonoj I'm not sure but it seems that jest doesn't cache config files (just try to run tests in this project and change any of |
: you're correct, it's not. Maybe my word is not clear - my point is, if preprocessor just rely on jest's caching behavior then it won't hit frequent access to config file even. For example, if user's codebase is ~1000 but only 10 files changes at the moment after transpilation jest will require preprocessor for those 10 files only. Obviously caching config will benefit performance in general, but my point is about high-level gain by achieving that. |
Ok, I understand your point. Anyway we have to create integration tests that check correctness of preprocessor output with caching before doing anything else in this direction. |
: yes, 100% agreed. |
As for now cache is disabled. But it seems that it would greatly increase performance, because of omitting of unnecessary transpilations.
We are able to cache next stuff:
tsconfig
in order to avoid extra disc I/O. It could be easily implemented intranspile-if-ts.ts
or inutils.ts
. But how to handle its changes during test running? And should we handle them, cause it doesn't seems to be common operation?tsconfig
I guess, but it needs further investigation. @kwonoj you probably know this better, any thoughts?sourceMapCache
is easily provided byfalse
value ofoptions.emptyCacheBetweenOperations
and may be with using ofoptions.hookRequire = true;
(but I'm not sure about this option) inindex.ts
.fileContentsCache
could be problematic. On one hand it seems that we are able to easily implement it in ourdefault-retrieve-file-handler.ts
, but on other hand it won't be the same thing assourceMapCache
fromsource-map-support
, because the last one isn't exported, so we have no access to it, more of that: it appears in a lot of different places throughsource-map-support.js
, so two caches could be mis-synchronized and produce a lot of mistakes.And at last, we have to find a way how to test that all this stuff works correctly and may be that it really improves performance. I guess, we could run
jest
process in our integration test with--watchAll
flag and rewrite.ts
,.tsx
and.json
files usingfs
, but I'm not sure that it is a good solution and even that it would work correctly.The text was updated successfully, but these errors were encountered: