JestRuntime:-Using scriptTransformer cache in jest-runner#13735
JestRuntime:-Using scriptTransformer cache in jest-runner#13735SimenB merged 3 commits intojestjs:mainfrom
Conversation
| ...transformedFile, | ||
| wrapperLength: this.constructModuleWrapperStart().length, | ||
| }); | ||
| if (this._fileTransforms.get(filename)?.code !== transformedFile.code) { |
There was a problem hiding this comment.
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.
yeah that way we can prevent the additional set
There was a problem hiding this comment.
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
SimenB
left a comment
There was a problem hiding this comment.
see comment. also, please add a changelog entry
|
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
getCachekeychanges for a file depending on the particular file it is running, the jest run-time has the_fileTransformscache 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.