perf(core): add private hooks around user code executed by the runtime #41421
+473
−12
Conversation
Introduces an **internal**, **experimental** `profiler` function, which
the runtime invokes around user code, including before and after:
- Running the template function of a component
- Executing a lifecycle hook
- Evaluating an output handler
The `profiler` function invokes a callback set with the global
`ng.ɵsetProfiler`. This API is **private** and **experimental** and
could be removed or changed at any time.
This implementation is cheap and available in production. It's cheap
because the `profiler` function is simple, which allows the JiT compiler
to inline it in the callsites. It also doesn't add up much to the
production bundle.
To listen for profiler events:
```ts
ng.ɵsetProfiler((event, ...args) => {
// monitor user code execution
});
```
|
The rebase with patch was trivial. There was only conflict in the payload size. |
|
Closed by commit 94af9d9 |
atscott
added a commit
that referenced
this issue
Apr 2, 2021
#41421) Introduces an **internal**, **experimental** `profiler` function, which the runtime invokes around user code, including before and after: - Running the template function of a component - Executing a lifecycle hook - Evaluating an output handler The `profiler` function invokes a callback set with the global `ng.ɵsetProfiler`. This API is **private** and **experimental** and could be removed or changed at any time. This implementation is cheap and available in production. It's cheap because the `profiler` function is simple, which allows the JiT compiler to inline it in the callsites. It also doesn't add up much to the production bundle. To listen for profiler events: ```ts ng.ɵsetProfiler((event, ...args) => { // monitor user code execution }); ``` PR Close #41421
|
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. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Patch PR [master here]
Introduces an internal, experimental
profilerfunction, which the runtime invokes around user code, including before and after:The
profilerfunction invokes a callback set with the globalng.ɵsetProfiler. This API is private and experimental and could be removed or changed at any time.This implementation is cheap and available in production. It's cheap because the
profilerfunction is simple, which allows the JiT compiler to inline it in the callsites. It also doesn't add up much to the production bundle.To listen for profiler events:
The text was updated successfully, but these errors were encountered: