Understanding Jekyll's --profile Tag

I don’t understand how Jekyll’s --profile tag works. You can see in the output below that the build time under Build Process Summary is 5.9669, but under Site Render Stats it is 11.631. Why are these different? Is there some documentation I can read to better understand what --profile is doing?

$ bundle exec jekyll build --profile
Configuration file: ~/project/_config.yml
            Source: ~/project
       Destination: ~/project/_site
 Incremental build: disabled. Enable with --incremental
      Generating... 

Build Process Summary: 

| PHASE      |   TIME |
+------------+--------+
| RESET      | 0.0002 |
| READ       | 0.1742 |
| GENERATE   | 0.0042 |
| RENDER     | 5.6775 |
| CLEANUP    | 0.0224 |
| WRITE      | 0.0884 |
+------------+--------+
| TOTAL TIME | 5.9669 |
 

Site Render Stats: 

| Filename                                                                                  | Count |     Bytes |   Time |
+-------------------------------------------------------------------------------------------+-------+-----------+--------+
| _includes/breadcrumbs.html                                                                |   122 |   101.21K |  2.873 |
| _includes/crumb.html                                                                      |   432 |    11.28K |  2.757 |
| _layouts/guide.html                                                                       |    52 |   656.66K |  1.657 |
| _layouts/documentation.html                                                               |    69 |  1098.76K |  1.473 |
| sitemap.xml                                                                               |     1 |    21.39K |  0.783 |
| _layouts/default.html                                                                     |   133 |  4956.31K |  0.616 |
| _includes/usa-banner.html                                                                 |   133 |   489.28K |  0.248 |
| _includes/header.html                                                                     |   133 |  1660.39K |  0.210 |
| _includes/language-switch.html                                                            |   133 |   121.31K |  0.197 |
| _includes/sidenav.html                                                                    |   116 |   812.14K |  0.189 |
| _includes/head.html                                                                       |   133 |   298.12K |  0.113 |
| _includes/doc-sidenav.html                                                                |    64 |   607.19K |  0.104 |
| _includes/guides-sidenav.html                                                             |    52 |   182.98K |  0.046 |
| _includes/lang_text.html                                                                  |  2030 |   106.44K |  0.042 |
| _includes/table.html                                                                      |     8 |    17.75K |  0.030 |
| _includes/alert.html                                                                      |    38 |    28.58K |  0.027 |
| pages/providers/es/planning-your-telehealth-workflow.md                                   |     1 |     7.53K |  0.021 |
| pages/patients/es/finding-telehealth-options.md                                           |     1 |     4.24K |  0.018 |
| pages/providers/es/telehealth-for-behavioral-health/billing-for-telebehavioral-health.md  |     1 |    11.10K |  0.018 |
| _includes/search-form.html                                                                |   133 |    42.92K |  0.014 |
| pages/partner-toolkit.md                                                                  |     1 |    14.76K |  0.014 |
| pages/providers/planning-your-telehealth-workflow.md                                      |     1 |     6.24K |  0.013 |
| _includes/spotlights.html                                                                 |    52 |     9.88K |  0.012 |
| _includes/touchpoints.html                                                                |   130 |    41.51K |  0.011 |
| pages/home.html                                                                           |     1 |    16.86K |  0.010 |
| _layouts/research.html                                                                    |     1 |    67.22K |  0.009 |
| pages/providers/telehealth-covid-19-vaccine_es.md                                         |     1 |     9.12K |  0.009 |
| pages/providers/sustain-your-telehealth-practice.md                                       |     1 |     5.01K |  0.008 |
| _includes/homepage_cards.html                                                             |     2 |    31.36K |  0.008 |
| pages/providers/telehealth-for-behavioral-health/billing-for-telebehavioral-health.md     |     1 |    10.05K |  0.008 |
| _includes/footer.html                                                                     |   133 |   463.57K |  0.007 |
| pages/providers/telehealth-covid-19-vaccine.md                                            |     1 |     8.15K |  0.007 |
| _includes/last_updated.html                                                               |   122 |     9.12K |  0.006 |
| pages/patients/es/telehealth-during-the-covid-19-emergency.md                             |     1 |     8.33K |  0.006 |
| pages/providers/es/telehealth-for-behavioral-health/index.md                              |     1 |    14.86K |  0.005 |
| _includes/contents_list.html                                                              |    64 |     9.09K |  0.005 |
| pages/patients/telehealth-during-the-covid-19-emergency.md                                |     1 |     7.21K |  0.005 |
| pages/providers/es/billing-and-reimbursement/index.md                                     |     1 |     5.88K |  0.005 |
| pages/providers/es/sustain-your-telehealth-practice.md                                    |     1 |     6.05K |  0.005 |
| pages/providers/billing-and-reimbursement/index.md                                        |     1 |     5.27K |  0.004 |
| pages/providers/es/telehealth-for-emergency-departments/billing.md                        |     1 |     5.04K |  0.004 |
| pages/providers/telehealth-for-emergency-departments/billing.md                           |     1 |     4.46K |  0.004 |
| pages/providers/es/index.html                                                             |     1 |    14.10K |  0.004 |
| _includes/lang-metadata.html                                                              |   133 |    18.31K |  0.004 |
| pages/patients/finding-telehealth-options.md                                              |     1 |     3.97K |  0.003 |
| _includes/landing-top-links.html                                                          |     6 |    62.01K |  0.003 |
| pages/providers/increasing-telehealth-equity-and-access/improving-access-to-telehealth.md |     1 |     8.95K |  0.003 |
| pages/providers/telehealth-for-behavioral-health/getting-started.md                       |     1 |     7.81K |  0.003 |
| pages/providers/es/telehealth-for-behavioral-health/getting-started.md                    |     1 |     9.28K |  0.003 |
| _includes/see-also.html                                                                   |   122 |     9.90K |  0.003 |
+-------------------------------------------------------------------------------------------+-------+-----------+--------+
| TOTAL (for 50 files)                                                                      |  4570 | 12128.96K | 11.631 |
 
                    done in 5.995 seconds.

TOTAL TIME | 5.9669 |

And

Your entire command only took 6 seconds so the time in the table total column can’t really be 11 seconds. Maybe it double counts some tasks that were cached or happened in parallel

Thanks Michael, but I was hoping for more detail.

I can see in lib/jekyll/profiler.rb the Site Render Stats table is being rendered by calling @site.print_stats. That is defined in lib/jekyll/site.rb like so:

def print_stats
  Jekyll.logger.info @liquid_renderer.stats_table
end

I get lost at this point. The stats_table in lib/jekyll/liquid_renderer.rb is defined like so:

def stats_table(num_of_rows = 50)
  LiquidRenderer::Table.new(@stats).to_s(num_of_rows)
end

But @stats is empty at the top of the file (@stats = {}).

In lib/jekyll/liquid_renderer/table.rb you can see where it is outputting the table, but I’m out of my depth here. The parse and render methods in lib/jekyll/liquid_renderer/file.rb look to be the meat of the issue, but again, I’m out of my depth.

Hello @brad, I’m one of the maintainers of Jekyll.
Like @MichaelCurrin said, the discrepancy you see in Build Process Summary and Site Render Stats is a bug.
Could you open a ticket at the Jekyll repo? I’ll try to fix the tally or remove the TOTAL row entirely if otherwise.

Regarding documentation to comprehend the info, there isn’t any because the info was deemed to be self-explanatory (until now :sweat_smile:)

Simply put, end-users should not be pulling their hair out trying to understand the printed information. But if you must know, then the summary is that @stats starts out as an empty Hash object and gets filled by the end of the build process which is when the LiquidRenderer::Table#to_s prints the collected stats.

A

1 Like

I’ve submitted an issue: #8796.

I don’t think the problem is with the tally. It seems to be an accurate sum of the time column above it.

Using my example, if I were to remove the breadcrumbs and crumbs includes I should get a build time of 0.3369 (5.9669−2.873−2.757), but I don’t. Removing those includes I’m getting:

Build Process Summary: 1.2662
Site Render Stats: 2.193

That is what I meant by problem with the tally.

For example, in the given stats above, the breadcrumb and crumb includes could be (assumption based on the “count”) rendered via the guide layout and directly by one of the pages or documents.
i.e, the 1.6s taken by the guide layout already consists of time taken to render the two includes and given content 52 times.

But the sum total at the end of the table doesn’t take that into consideration.

C=> How I reduced my Jekyll build time by 61% | Forestry.io