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

new cache for readFile, fileExists, directoryExist, is not working as advertised #29107

Closed
Farbdose opened this issue Dec 20, 2018 · 2 comments
Closed
Assignees
Labels
Domain: Performance Reports of unusually slow behavior Needs Investigation This issue needs a team member to investigate its status. Working as Intended The behavior described is the intended behavior; this is not a bug

Comments

@Farbdose
Copy link

Farbdose commented Dec 20, 2018

I encountered a significant performance drop in ts-jest which I was able to track down to typescript reading package.json files over and over.

After doing so I realized that you knew of this problem and that you even already pushed a fix for it

So I updated typescript and it got even worse. The node_modules folder of the demo repository contains 600 package.json files which result in about 35k readFile calls to these files.

TypeScript Version: 3.3.0-dev.20181220

Search Terms: cache readFile fileExists directoryExist readJson

Code https://gitlab.com/Farbdose/ts-jest-multiple-fileread/tree/typescript-3.3.0
This almost empty repository takes now 45 seconds in the gitlab build pipeline to run an empty jest test-suite.
Be aware that there is a non-zero chance that this is caused by some bad interaction between typescript, jest, ts-jest and ionic but I'm out of ideas...

Expected behavior: read each package.json only once

Actual behavior: each file in the node_modules folder causes at least one readFile-call to the package.json of the module it's located in

Related Issues:
#27068 #28629
kulshekhar/ts-jest#908
ionic-team/ionic-framework#16703

@Farbdose Farbdose changed the title new cache for readFile, fileExists, directory exist, is not working as advertised new cache for readFile, fileExists, directoryExist, is not working as advertised Dec 20, 2018
@weswigham weswigham added Needs Investigation This issue needs a team member to investigate its status. Domain: Performance Reports of unusually slow behavior labels Dec 20, 2018
@sheetalkamat
Copy link
Member

@Farbdose #28629 only adds caches when invoking tsc not with other default compiler host. What I see from jest is that it uses typescript.js so it wont have the compiler host supporting cache. It is expected that the program creator to create compiler host and maintain its cache for any other use since we do not watch any files and wont know when to invalidate what.

@sheetalkamat sheetalkamat added the Working as Intended The behavior described is the intended behavior; this is not a bug label Dec 20, 2018
@typescript-bot
Copy link
Collaborator

This issue has been marked 'Working as Intended' and has seen no recent activity. It has been automatically closed for house-keeping purposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Domain: Performance Reports of unusually slow behavior Needs Investigation This issue needs a team member to investigate its status. Working as Intended The behavior described is the intended behavior; this is not a bug
Projects
None yet
Development

No branches or pull requests

4 participants