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

Assess build performance #85

Closed
hinerm opened this issue Apr 30, 2021 · 4 comments
Closed

Assess build performance #85

hinerm opened this issue Apr 30, 2021 · 4 comments
Milestone

Comments

@hinerm
Copy link
Member

hinerm commented Apr 30, 2021

A fresh build of the site seems quite slow on my laptop (10+ minutes) and even rebuilds with --incremental can be slow.

The general profile is:

Filename                                                     | Count |     Bytes |    Time
-------------------------------------------------------------+-------+-----------+--------
_layouts/page.html                                           |  1495 | 47892.91K | 590.950
_includes/main-menu                                          |  1496 | 32242.51K | 553.651
_includes/hamburger-menu                                     |  1496 | 16462.66K | 273.042
_includes/menu-item                                          |  1496 | 24551.32K |  19.809
_includes/statbox                                            |  1495 |   384.98K |  15.639
_includes/person                                             |   234 |    73.49K |  15.426
_includes/menu-section                                       |  1496 |  4203.63K |   7.661
_pages/events/Hackathon.md                                   |     1 |    41.35K |   6.147
_includes/person-list                                        |     1 |    27.13K |   6.068
_includes/html-head                                          |  1496 |  1950.38K |   3.477
_includes/onebox-info                                        |  1496 |   727.58K |   1.687
sitemap.xml                                                  |     1 |   178.19K |   1.137
_includes/info-box                                           |   350 |   327.20K |   1.080
_includes/statbox-team-members                               |   103 |   170.90K |   0.918
_pages/about/governance.md                                   |     1 |    19.68K |   0.789
_includes/menu-section-end                                   |  1496 |  1545.16K |   0.732
_pages/plugin-index.md                                       |     1 |   111.55K |   0.678
_includes/plugin-index-section                               |     1 |   111.40K |   0.668
_pages/news/2017-09-25_-_KNIME_Image_Processing_hackathon.md |     1 |     9.75K |   0.647
_pages/about/contributors.md                                 |     1 |     7.97K |   0.646
_pages/news/2016-12-20_-_Fiji_+_KNIP_hackathon.md            |     1 |    18.99K |   0.583
_pages/learn/presentations.md                                |     1 |    25.13K |   0.563
_pages/libs/imagej-ops/comparison-with-matlab.md             |     1 |    94.52K |   0.544
_includes/github                                             |   289 |    90.81K |   0.437
_pages/news/2016-01-29_-_KNIME_Image_Processing_hackathon.md |     1 |    15.28K |   0.379
_includes/page-info                                          |  1495 |   501.77K |   0.309
_pages/news/2017-12-04_-_Fiji_+_KNIP_hackathon.md            |     1 |    16.68K |   0.289
_pages/users/ctrueden.md                                     |     1 |     9.91K |   0.283
_pages/about/funding.md                                      |     1 |     6.23K |   0.213
_pages/orgs/loci.md                                          |     1 |     2.44K |   0.210
_includes/statbox-row                                        |   366 |   344.33K |   0.207
_includes/bc                                                 |   266 |   105.36K |   0.199
_layouts/home.html                                           |     1 |    19.56K |   0.187
_pages/imglib2/index.md                                      |     1 |     3.98K |   0.175
_pages/plugins/image-stitching.md                            |     1 |    30.54K |   0.172
_pages/news/2016-06-23_-_ImgLib2_hackathon.md                |     1 |     6.89K |   0.171
_pages/news/2016-07-21_-_KNIME_Image_Processing_hackathon.md |     1 |     7.57K |   0.163
_pages/plugins/bar.md                                        |     1 |    37.72K |   0.134
_pages/events/Conference_2015_Hackathon.md                   |     1 |     6.00K |   0.120
_pages/plugins/mamut/getting-started.md                      |     1 |    78.58K |   0.119
_pages/plugins/sholl-analysis.md                             |     1 |    77.57K |   0.115
_pages/plugins/morpholibj.md                                 |     1 |    69.89K |   0.115
_includes/publication                                        |    43 |    21.08K |   0.114
_pages/plugins/cover-maker.md                                |     1 |    28.43K |   0.110
_includes/citation                                           |    27 |    16.25K |   0.108
_pages/FunImageJ.md                                          |     1 |     1.14K |   0.106
_pages/imglib2/discussion.md                                 |     1 |    26.57K |   0.099
_pages/plugins/bonej.md                                      |     1 |    60.96K |   0.098
_pages/plugins/snt/manual.md                                 |     1 |    55.21K |   0.097
_pages/guide/working-with-imagej.md                          |     1 |    64.65K |   0.095

done in 646.672 seconds.

The heavy use of includes, particularly in the main menu, are the primary bottleneck. Jekyll 4 has a built-in include caching mechanism, but is incompatible with the gh-pages gem. I tried using the third-party include cache but it has some restrictions on how includes are called and so without any modifications to our templates it actually increased build time to 769.185 seconds.

Other common suggestions for improving performance are switching to c-compiled gems, particularly liquidc and sassc. I tried liquidc thinking it might improve performance of the include parsing.. but it actually slowed things down to 994.955 seconds...!!

In any case, the include performance is probably disk I/O bound. When parsing include templates, liquid reads the file from disk EACH time. So, main-menu's extensive use of includes represents the bulk of this time (main-menu itself is included twice per page: once directly and once in the hamburger-menu). I tested replacing the main-menu's includes with direct HTML and it dropped the build time almost an order of magnitude (107.511 seconds).

Given that the content is static I think converting to HTML could be reasonable. Open to other thoughts.

@hinerm hinerm added this to the unscheduled milestone Apr 30, 2021
@hinerm
Copy link
Member Author

hinerm commented Apr 30, 2021

@ctrueden this isn't essential but I'm interested in your thoughts

@hinerm
Copy link
Member Author

hinerm commented Apr 30, 2021

Also this is largely a Windows problem. Even my infinitely-better desktop takes 359.18 seconds to build. But my Ubuntu 20.04 subsystem on the same computer builds in 114 seconds.

Supposedly wdm should normalize build times between systems but it hasn't had any effect in my experience.

@ctrueden
Copy link
Member

ctrueden commented May 1, 2021

I don't have much insight, other than a naive claim that "Ruby is slow" and "Windows file locking is slow", and perhaps more wackily: "GraalVM's implementation of Ruby is 8x faster." I wonder if it's possible to run Jekyll using GraalVM?? 😜

@ctrueden
Copy link
Member

@hinerm Are you OK closing this issue, now that we are building locally with Jekyll 4.2?

@hinerm hinerm closed this as completed May 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants