95fc3d4c5c
Currently destroy hooks are stored in memory as `[1, hook, 5, hook]` where the numbers represent the index at which to find the context and `hook` is the function to be invoked. This breaks down for `multi` providers, because the value at the index will be an array of providers, resulting in the hook being invoked with an array of all the multi provider values, rather than the provider that was destroyed. In ViewEngine `ngOnDestroy` wasn't being called for `multi` providers at all. These changes fix the issue by changing the structure of the destroy hooks to `[1, hook, 5, [0, hook, 3, hook]]` where the indexes inside the inner array point to the provider inside of the multi provider array. Note that this is slightly different from the original design which called for the structure to be `[1, hook, 5, [hook, hook]`, because in the process of implementing it, I realized that we wouldn't get passing the correct context if only some of the `multi` providers have `ngOnDestroy` and others don't. I've run the newly-added `view_destroy_hooks` benchmark against these changes and compared it to master. The difference seems to be insignificant (between 1% and 2% slower). Fixes #35231. PR Close #35840
68 lines
1.6 KiB
JSON
68 lines
1.6 KiB
JSON
{
|
|
"cli-hello-world": {
|
|
"master": {
|
|
"uncompressed": {
|
|
"runtime-es2015": 1485,
|
|
"main-es2015": 142073,
|
|
"polyfills-es2015": 36657
|
|
}
|
|
}
|
|
},
|
|
"cli-hello-world-ivy-minimal": {
|
|
"master": {
|
|
"uncompressed": {
|
|
"runtime-es2015": 1485,
|
|
"main-es2015": 16514,
|
|
"polyfills-es2015": 36657
|
|
}
|
|
}
|
|
},
|
|
"cli-hello-world-ivy-compat": {
|
|
"master": {
|
|
"uncompressed": {
|
|
"runtime-es2015": 1485,
|
|
"main-es2015": 148196,
|
|
"polyfills-es2015": 36657
|
|
}
|
|
}
|
|
},
|
|
"cli-hello-world-ivy-i18n": {
|
|
"master": {
|
|
"uncompressed": {
|
|
"runtime-es2015": 1485,
|
|
"main-es2015": 137320,
|
|
"polyfills-es2015": 37334
|
|
}
|
|
}
|
|
},
|
|
"cli-hello-world-lazy": {
|
|
"master": {
|
|
"uncompressed": {
|
|
"runtime-es2015": 2289,
|
|
"main-es2015": 247727,
|
|
"polyfills-es2015": 36657,
|
|
"5-es2015": 751
|
|
}
|
|
}
|
|
},
|
|
"cli-hello-world-lazy-rollup": {
|
|
"master": {
|
|
"uncompressed": {
|
|
"runtime-es2015": 2289,
|
|
"main-es2015": 226728,
|
|
"polyfills-es2015": 36657,
|
|
"5-es2015": 779
|
|
}
|
|
}
|
|
},
|
|
"hello_world__closure": {
|
|
"master": {
|
|
"uncompressed": {
|
|
"bundle": "TODO(i): temporarily increase the payload size limit from 105779 - this is due to a closure issue related to ESM reexports that still needs to be investigated",
|
|
"bundle": "TODO(i): we should define ngDevMode to false in Closure, but --define only works in the global scope.",
|
|
"bundle": 170618
|
|
}
|
|
}
|
|
}
|
|
}
|