-
Notifications
You must be signed in to change notification settings - Fork 759
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
statemanager: re architect shallow copy to improve tree shaking #3596
statemanager: re architect shallow copy to improve tree shaking #3596
Conversation
import { modifyAccountFields } from './util.js' | ||
|
||
import { CODEHASH_PREFIX, Caches, type DefaultStateManagerOpts } from './index.js' |
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.
👀
Ah, ok, now I get it.
So seems my observation was correct (?).
Cool, great dive and find! 🎉 🙂
code: codeCacheOpts, | ||
storage: storageCacheOpts, | ||
}), | ||
caches: this._caches?.shallowCopy(downlevelCaches), |
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.
🤯
Ugh. That's really a brilliant separation!
Codecov ReportAll modified and coverable lines are covered by tests ✅
|
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.
LGTM
This PR restructures shallowCopy method of the DefaultStateManager. This improves bundle size significantly (tested with the
statemanager/examples/basicUsage.ts
file :Before the change
After the change
The improvement comes from the removal of the
Caches
class dependency from the shallowCopy method.