-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
JestRuntime:-Using scriptTransformer cache in jest-runner #13735
Conversation
packages/jest-runtime/src/index.ts
Outdated
...transformedFile, | ||
wrapperLength: this.constructModuleWrapperStart().length, | ||
}); | ||
if (this._fileTransforms.get(filename)?.code !== transformedFile.code) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can remove this if
and just always populate the cache. Then it's a single set
instead of a single get
and sometimes an additional set
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah that way we can prevent the additional set
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a set
isn't more expensive than get
(just the extra spread in the object). and a single set
is less expensive than get
and set
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see comment. also, please add a changelog entry
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks!
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
The
getCachekey
changes for a file depending on the particular file it is running, the jest run-time has the_fileTransforms
cache that it checks to call before the _scriptTransformer.transform. I am suggesting to not doing the whole cache check and rather use the_scriptTransformer.transform
's cache. this way we already have a cache using thegetCacheKey
, counting this, the performance wont be affected i think.Quite unsure how should i do a test for the same.