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(core): avoid unnecessary callbacks in after render hooks #52292
Conversation
A few performance improvements and code cleanups in the after render hooks: 1. We were wrapping each `destroy` callback in another callback, because it was typed as `|undefined`. This is unnecessary, because the callback is guaranteed to exist. These changes pass the `destroy` function around directly and avoid the additional callback. 2. In server platforms we were recreating a noop `AfterRenderRef` on each invocation. We can save some memory by returning the same one. 3. Reworks the `AfterRenderCallback` so that it injects `NgZone` and `ErrorHandler` itself, instead of expecting them to be passed in. This reduces the amount of repetition in the code.
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.
👍
This PR was merged into the repository by commit cce3743. |
A few performance improvements and code cleanups in the after render hooks: 1. We were wrapping each `destroy` callback in another callback, because it was typed as `|undefined`. This is unnecessary, because the callback is guaranteed to exist. These changes pass the `destroy` function around directly and avoid the additional callback. 2. In server platforms we were recreating a noop `AfterRenderRef` on each invocation. We can save some memory by returning the same one. 3. Reworks the `AfterRenderCallback` so that it injects `NgZone` and `ErrorHandler` itself, instead of expecting them to be passed in. This reduces the amount of repetition in the code. PR Close #52292
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
…r#52292) A few performance improvements and code cleanups in the after render hooks: 1. We were wrapping each `destroy` callback in another callback, because it was typed as `|undefined`. This is unnecessary, because the callback is guaranteed to exist. These changes pass the `destroy` function around directly and avoid the additional callback. 2. In server platforms we were recreating a noop `AfterRenderRef` on each invocation. We can save some memory by returning the same one. 3. Reworks the `AfterRenderCallback` so that it injects `NgZone` and `ErrorHandler` itself, instead of expecting them to be passed in. This reduces the amount of repetition in the code. PR Close angular#52292
…r#52292) A few performance improvements and code cleanups in the after render hooks: 1. We were wrapping each `destroy` callback in another callback, because it was typed as `|undefined`. This is unnecessary, because the callback is guaranteed to exist. These changes pass the `destroy` function around directly and avoid the additional callback. 2. In server platforms we were recreating a noop `AfterRenderRef` on each invocation. We can save some memory by returning the same one. 3. Reworks the `AfterRenderCallback` so that it injects `NgZone` and `ErrorHandler` itself, instead of expecting them to be passed in. This reduces the amount of repetition in the code. PR Close angular#52292
A few performance improvements and code cleanups in the after render hooks:
destroy
callback in another callback, becausedestroy
was typed as|undefined
. This is unnecessary, because the callback is guaranteed to exist. These changes pass thedestroy
function around directly and avoid the additional callback.AfterRenderRef
on each invocation. We can save some memory by returning the same one.AfterRenderCallback
so that it injectsNgZone
andErrorHandler
itself, instead of expecting them to be passed in. This reduces the amount of repetition in the code.