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

Implementing a cache for the gettersProxy object creation #1546

Merged
merged 4 commits into from
Nov 9, 2019

Conversation

frankcs
Copy link
Contributor

@frankcs frankcs commented May 3, 2019

Fixes #1539

…erformance wth large number of modules/getters
Copy link
Member

@ktsn ktsn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for making this PR!
Please remove package-lock.json and revert the change to dist/vuex.common.js

src/store.js Outdated
Object.defineProperty(gettersProxy, localType, {
get: () => store.getters[type],
enumerable: true
if (cacheStore !== store) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This way of clearing cache is not comprehensive. Getters may be changed via registerModule, unregisterModule or hotUpdate.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much for your reply! Could you give me a hint here?
I see that all those functions end up calling resetStoreVM, do you think that is the proper place to clear the cache?
That way I could also get rid of that cacheStore variable

Copy link
Member

@ktsn ktsn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resetting it in resetStoreVM looks very good idea 👍
I've commented for some small tweaks.

src/store.js Outdated Show resolved Hide resolved
src/store.js Outdated Show resolved Hide resolved
Copy link
Member

@ktsn ktsn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@ktsn ktsn merged commit 4003382 into vuejs:dev Nov 9, 2019
@vue-bot
Copy link

vue-bot commented Nov 9, 2019

Hey @frankcs, thank you for your time and effort spent on this PR, contributions like yours help make Vue better for everyone. Cheers! 💚

@frankcs frankcs deleted the feature/cache-getters-proxy branch November 9, 2019 18:20
@afwn90cj93201nixr2e1re
Copy link

@ktsn can you check my issue too? vuejs/devtools-v6#1058

@jeffrey-bin
Copy link

image
why not just use
oldVm =null;
since there is still memory leak problem now, please reconsider this issue ,tks #1507

vaga pushed a commit to vaga/vuex that referenced this pull request Apr 20, 2020
…s#1546)

* Implementing a cache for the gettersProxy object creation. Kill ssr performance wth large number of modules/getters

* Revert "Implementing a cache for the gettersProxy object creation. Kill ssr performance wth large number of modules/getters"

This reverts commit 2df536b.

* Resetting the make local getters cache when the store gets updated

* Changing cache to makeLocalGetters to instance internal state
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

makeLocalGetters performance hit on ssr
5 participants