-
-
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
chore: use Map
s rather than objects as cache holders
#9902
Conversation
type StringMap = Map<string, string>; | ||
type BooleanMap = Map<string, boolean>; | ||
|
||
const fromEntries: typeof Object.fromEntries = |
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.
Object.fromEntries
was added in node 12.
Can ditch this when jest-resolve
uses a Map
as well
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.
Yes please
bdae3ac
to
1962370
Compare
packages/jest-runtime/src/index.ts
Outdated
this._moduleImplementation = undefined; | ||
|
||
// @ts-ignore | ||
this._config = undefined; |
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.
probably not needed, but doesn't hurt do help GC along
ecc9aae
to
94cbbd7
Compare
Ah, this of course breaks pretty hard when the user does something after teardown |
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. |
Summary
Map
s are about twice as fast for larger data sets in Chrome 80, very much likely this applies to Node as well: https://stackoverflow.com/a/55711780/1850276Similar to #8232, but applied to all caches.
(Includes #9900 as I forgot to switch to master first and can't be bothered to fix the conflict twice 😀 Please review second commit until I rebase)Test plan
Green CI.