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

Add debug.Timer #11580

Closed
bep opened this issue Oct 19, 2023 · 1 comment · Fixed by #11581
Closed

Add debug.Timer #11580

bep opened this issue Oct 19, 2023 · 1 comment · Fixed by #11581
Assignees
Milestone

Comments

@bep
Copy link
Member

bep commented Oct 19, 2023

Some times I struggle to find the performance bottle neck in my Hugo site/templates, and it can be hard to debug.

What I think would be useful is to have something like:

{{ $timer := debug.Timer "My slow template" }}
... do slow work.
{{ $timer.Stop }}

This would be backed by a map, so when we print it at the end of the build (I assume INFO should be OK), what you get is the accumulated duration.

@bep bep added this to the v0.120.0 milestone Oct 19, 2023
@bep bep self-assigned this Oct 19, 2023
@bep bep changed the title Add debug.Timer Add time.Timer Oct 19, 2023
@bep bep changed the title Add time.Timer Add debug.Timer Oct 19, 2023
bep added a commit to bep/hugo that referenced this issue Oct 19, 2023
bep added a commit to bep/hugo that referenced this issue Oct 19, 2023
bep added a commit to bep/hugo that referenced this issue Oct 19, 2023
bep added a commit to bep/hugo that referenced this issue Oct 19, 2023
bep added a commit to bep/hugo that referenced this issue Oct 19, 2023
bep added a commit to bep/hugo that referenced this issue Oct 19, 2023
bep added a commit to bep/hugo that referenced this issue Oct 19, 2023
bep added a commit to bep/hugo that referenced this issue Oct 19, 2023
bep added a commit to bep/hugo that referenced this issue Oct 19, 2023
bep added a commit that referenced this issue Oct 20, 2023
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant