Skip to content
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): add private hooks around user code executed by the runtime #41421

Closed
wants to merge 1 commit into from

Conversation

@mgechev
Copy link
Member

@mgechev mgechev commented Apr 1, 2021

Patch PR [master here]

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:

ng.ɵsetProfiler((event, ...args) => {
  // monitor user code execution
});
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
});
```
@ngbot ngbot bot added this to the Backlog milestone Apr 1, 2021
@ngbot ngbot bot added this to the Backlog milestone Apr 1, 2021
@google-cla google-cla bot added the cla: yes label Apr 1, 2021
@pullapprove pullapprove bot requested a review from alxhub Apr 1, 2021
@ngbot ngbot bot added the action: merge label Apr 2, 2021
@mgechev
Copy link
Member Author

@mgechev mgechev commented Apr 2, 2021

The rebase with patch was trivial. There was only conflict in the payload size.

@atscott
Copy link
Contributor

@atscott atscott commented Apr 2, 2021

Closed by commit 94af9d9

@atscott atscott closed this Apr 2, 2021
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
@mgechev mgechev deleted the profiler-patch branch Apr 2, 2021
@angular-automatic-lock-bot
Copy link

@angular-automatic-lock-bot angular-automatic-lock-bot bot commented May 3, 2021

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators May 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants