-
Notifications
You must be signed in to change notification settings - Fork 344
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
perf: more light-weight computed #452
Conversation
Interesting, can you have a simple pref comparison on this? Thanks |
相对于原来的实现, 现在的 computed 只用到一个 Watcher 对象, 而原来的用到了 Vue对象, 在初始化 Vue 实例时, 需要做很多额外的工作, 比如调用生命周期方法等, 而且内存占用相对更多. 相比较而言, 只用 Watcher 对象要轻量得多, 我在项目中已经这样用了一个月多了, 没有发现什么奇怪的问题 |
@shaonialife This PR looks promising and I would love to have this improvement, but before getting this merged, we should have a pref test/benchmarking to show the difference. I can do that when I got some time. Or if you would like to try, please feel free to do so. Thanks! |
@antfu 仅仅是一个内存占用测试, 没有测试其他项目😊 https://github.com/shaonialife/vue-computed-mem-test |
@shaonialife Wow, that's a huge improvement, thanks for your work :) The code looks good to me, /cc @pikax what do you think? |
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.
Also good to me!
Thank you 🚀
No description provided.