-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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(reactivity): effectScope.ts variable declarations optimized and remove useless code in effect.ts #11721
Conversation
… remove useless code in effect.ts
Size ReportBundles
Usages
|
commit: @vue/compiler-core
@vue/compiler-dom
@vue/compiler-sfc
@vue/compiler-ssr
@vue/reactivity
@vue/runtime-core
@vue/runtime-dom
@vue/server-renderer
@vue/shared
vue
@vue/compat
|
The decrease in batchDepth can be written in two ways. While the second method (--x) is simpler in terms of code, it doesn't quite match the coding style used elsewhere (where x-- is predominantly used). I'm not sure if it's worth making this change. I really appreciate the suggestion! // type 1
batchDepth--
if (batchDepth > 0) {
return
}
// type 2
if (--batchDepth > 0) {
return
} |
@heggria if (batchDepth > 1) {
batchDepth--
return
}
batchDepth--
//... |
@edison1105 Thank you so much for your comment! However, after carefully examining and running the code, I reached the conclusion that the results are the same.
Therefore, aside from the difference in timing between when Once again, thank you for taking the time to review my PR! |
uh... sorry, I think I got my thoughts mixed up just now. 😓 |
No worries, it happens to all of us. 😊 The code is now using type 2. Thanks for your suggestion! |
This PR primarily modifies effectScope.ts, attempting to replace multiple let declarations within for loops with a single let declaration to enhance performance and maintain consistency with the stop function's style. Additionally, it removes redundant code from effect.ts.