-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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(runtime-core): memoize getType #9739
Conversation
Size ReportBundles
Usages
|
Do you have an example repro for me to further investigate this?
Even for the same component, |
I did a bit of investigation into this myself. This was the example I came up with:
I tried running a few benchmarks. Reading the In my example, the main problem seems to be just that the function gets called so many times. Each button click calls it about 640,000 times. There are 1000 components in my example, each with 160 types, so it needs to call
So 320,000 of those calls to The caching in this PR didn't seem to help very much, at least in my testing. The underlying problem remains, that the function is being called far more than is necessary. From looking at how But that's as far as I've got for now. I haven't tried experimenting with potential improvements. Before taking it further, I'd be curious to know whether my example is anywhere close to what @KaelWD had in mind. |
@yyx990803 I wonder, isn't it possible to just use |
This function takes ~10-15% of the time when rendering a large number of components with lots of defined props.
Side note, is there a reason normalizePropsOptions is called for every vnode instead of just once in defineComponent?