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 actually cached percentage column to --templateMetrics #8375

Closed
davidsneighbour opened this issue Mar 30, 2021 · 3 comments · Fixed by #8376
Closed

Add actually cached percentage column to --templateMetrics #8375

davidsneighbour opened this issue Mar 30, 2021 · 3 comments · Fixed by #8376
Assignees
Milestone

Comments

@davidsneighbour
Copy link
Contributor

davidsneighbour commented Mar 30, 2021

This is about this topic in discourse.

I am proposing to add a column to the CLI parameter --templateMetrics in addition to "cache potential" that shows how many of the calls to that partial were actually cached. In a properly set up template structure this would lead to an easy 100/100 for partials that are actually cached and one does not need to go through all templates and see, if those "potentially cached" partials are already cached.

@moorereason moorereason self-assigned this Mar 30, 2021
@moorereason moorereason added this to the v0.83 milestone Mar 30, 2021
moorereason added a commit to moorereason/hugo that referenced this issue Mar 30, 2021
@moorereason
Copy link
Contributor

I've submitted a PR to address this issue. PTAL

@bep bep added Enhancement and removed Proposal labels Mar 30, 2021
moorereason added a commit to moorereason/hugo that referenced this issue Apr 1, 2021
Track cached partial executions and display that info in the hints
output.  Sample output for examples/multilingual site:

     cumulative       average       maximum      cache  percent  cached  total
       duration      duration      duration  potential   cached   count  count  template
     ----------      --------      --------  ---------  -------  ------  -----  --------
       2.6973ms     674.325µs       857.3µs          0        0       0      4  _internal/_default/rss.xml
       2.6295ms     657.375µs       861.3µs          0        0       0      4  _default/single.html
       1.2563ms     314.075µs       381.5µs          0        0       0      4  news/single.html
        799.2µs       399.6µs       573.3µs          0        0       0      2  _internal/_default/sitemap.xml
        667.3µs       66.73µs       238.6µs         84        0       0     10  partials/header.html
        656.7µs      328.35µs       459.4µs          0        0       0      2  _default/list.html
        479.7µs       47.97µs         158µs         92        0       0     10  partials/head.html
        323.3µs       323.3µs       323.3µs          0        0       0      1  _internal/alias.html
        200.7µs       200.7µs       200.7µs          0        0       0      1  _internal/_default/sitemapindex.xml
         36.1µs       6.016µs        32.6µs        100       33       2      6  partials/footer.html
         27.4µs        13.7µs        26.7µs          0        0       0      2  index.html

Fixes gohugoio#8375
@bep bep modified the milestones: v0.83, v0.84 May 1, 2021
@davidsneighbour
Copy link
Contributor Author

While you are touching this whole calculation: I just had a very arbitrary weird cachable column that I can't reproduce or explain:

          0   47.981692ms   23.990846ms   26.010678ms      2  newsletter/single.html
  -51240955760304224   45.815675ms     254.531µs    5.470965ms    180  partials/func/hook.html
        100   42.964632ms    2.864308ms   20.827679ms     15  partials/sidebar.html

for some reason there is a large negative number instead of a 0 to 100 for the hook.html file. That is a partial that I use to call, well, hooks per installation. An easy way to add stuff to themes (like analytics code in the footer or some ads between posts).

Use https://github.com/dnb-hugo/hugonewsletter.com if you want to replay the issue, but I am not 100% sure I have all updates to the modules up. The partial in question is in https://github.com/dnb-hugo/hooks and I did not change things there today and don't remember seeing that weird number before today.

@bep bep modified the milestones: v0.84, v0.85 Jun 18, 2021
@bep bep modified the milestones: v0.85, v0.86 Jul 5, 2021
@bep bep modified the milestones: v0.86, v0.87, v0.88 Jul 26, 2021
@bep bep modified the milestones: v0.88, v0.89 Sep 2, 2021
@bep bep modified the milestones: v0.89, v0.90 Nov 2, 2021
@bep bep modified the milestones: v0.90, v0.91.0 Dec 13, 2021
@bep bep modified the milestones: v0.91.0, v0.92.0 Dec 22, 2021
@bep bep modified the milestones: v0.92.0, v0.93.0 Jan 12, 2022
moorereason added a commit to moorereason/hugo that referenced this issue Feb 16, 2022
Track cached partial executions and display more useful info when
showing the hints output. Also group cache hints and counters together
to the right of the timing measurements.

Sample output:

     cumulative       average       maximum      cache  percent  cached  total
       duration      duration      duration  potential   cached   count  count  template
     ----------      --------      --------  ---------  -------  ------  -----  --------
       2.6973ms     674.325µs       857.3µs          0        0       0      4  _internal/_default/rss.xml
       2.6295ms     657.375µs       861.3µs          0        0       0      4  _default/single.html
       1.2563ms     314.075µs       381.5µs          0        0       0      4  news/single.html
        799.2µs       399.6µs       573.3µs          0        0       0      2  _internal/_default/sitemap.xml
        667.3µs       66.73µs       238.6µs         84        0       0     10  partials/header.html
        656.7µs      328.35µs       459.4µs          0        0       0      2  _default/list.html
        479.7µs       47.97µs         158µs         92        0       0     10  partials/head.html
        323.3µs       323.3µs       323.3µs          0        0       0      1  _internal/alias.html
        200.7µs       200.7µs       200.7µs          0        0       0      1  _internal/_default/sitemapindex.xml
         36.1µs       6.016µs        32.6µs        100       33       2      6  partials/footer.html
         27.4µs        13.7µs        26.7µs          0        0       0      2  index.html

Fixes gohugoio#8375
@bep bep closed this as completed in #8376 Feb 16, 2022
bep pushed a commit that referenced this issue Feb 16, 2022
Track cached partial executions and display more useful info when
showing the hints output. Also group cache hints and counters together
to the right of the timing measurements.

Sample output:

     cumulative       average       maximum      cache  percent  cached  total
       duration      duration      duration  potential   cached   count  count  template
     ----------      --------      --------  ---------  -------  ------  -----  --------
       2.6973ms     674.325µs       857.3µs          0        0       0      4  _internal/_default/rss.xml
       2.6295ms     657.375µs       861.3µs          0        0       0      4  _default/single.html
       1.2563ms     314.075µs       381.5µs          0        0       0      4  news/single.html
        799.2µs       399.6µs       573.3µs          0        0       0      2  _internal/_default/sitemap.xml
        667.3µs       66.73µs       238.6µs         84        0       0     10  partials/header.html
        656.7µs      328.35µs       459.4µs          0        0       0      2  _default/list.html
        479.7µs       47.97µs         158µs         92        0       0     10  partials/head.html
        323.3µs       323.3µs       323.3µs          0        0       0      1  _internal/alias.html
        200.7µs       200.7µs       200.7µs          0        0       0      1  _internal/_default/sitemapindex.xml
         36.1µs       6.016µs        32.6µs        100       33       2      6  partials/footer.html
         27.4µs        13.7µs        26.7µs          0        0       0      2  index.html

Fixes #8375
@github-actions
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 Mar 10, 2022
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.

3 participants