2

I'm developing a blog using jekyll and up until now I was very happy with it. But as I make more posts the regeneration times are getting ridiculous (3-4 minutes). It's just not feasible to wait that long every time you make a change.

Specs:

  • Ruby 2.2.1
  • Jekyll 2.5.3
  • markdown: kramdown
  • highlighter: pygments
  • permalink:pretty
  • Working on a cloud service (Cloud9) with 2 GB of RAM
  • Not a lot of posts (~10), but I do use a lot of data (10 MB of json files in the "_data" folder, 14 MB of images in "img" folder)
  • Total size of the "_site" folder is 40 MB

Is it a normal thing with these specifications?

I've updated to Jekyll 3.0 to try incremental regeneration, but it didn't help in my case.

Any ideas?

Thanks!

Willem

  • 1
    With no code to benchmark, it's difficult. Maybe you can look for nested for loops that can be costly. – David Jacquel Nov 04 '15 at 18:45
  • Possible duplicate of [Jekyll compiling seems WAY too slow](https://stackoverflow.com/questions/26855552/jekyll-compiling-seems-way-too-slow) – Damjan Pavlica Jun 27 '17 at 17:50

3 Answers3

5

Run jekyll serve --profile on your site and check what is taking more time to render. It should output a table that looks something like this.

Filename                                                              | Count |    Bytes |  Time
----------------------------------------------------------------------+-------+----------+------
_layouts/compress.html                                                |    73 | 1649.86K | 1.526
_layouts/default.html                                                 |    72 | 1874.79K | 0.445
_layouts/post.html                                                    |    58 |  980.02K | 0.307
_posts/2015-12-10-how-to-create-and-host-a-website-on-github-pages.md |     1 |    9.36K | 0.294
feed.xml                                                              |     1 |   34.74K | 0.105
_includes/prev-next.html                                              |    58 |   39.17K | 0.053
sitemap.xml                                                           |     1 |   19.90K | 0.035
_pages/archive.md                                                     |     1 |   28.98K | 0.035
_posts/2017-02-15-jekyll-sort-filters.md                              |     1 |   16.09K | 0.019
_includes/ga_data_fetch.html                                          |    58 |   41.77K | 0.018
_includes/disqus-script.html                                          |    58 |   30.89K | 0.018
_pages/tags.html                                                      |     1 |   14.97K | 0.015

That should give you a fair idea on where the problem exists.

Now while making changes to the site, if you want to render only the changed files then use jekyll serve --incremental or jekyll serve -I.

Incremental build still has some issues that the Jekyll team is working on.

A handy option to render only the latest post that you are writing would be jekyll serve --watch --limit_posts 1. This has saved me a lot of time while writing new posts.

Sharath kumar
  • 1,118
  • 13
  • 17
4

There are a few options

  1. Use --incremental on jekyll build or serve but use with caution
  2. Use --profile on jekyll build to get an output of where time is used up
  3. You could also have different config.yml files where you might include only draft posts for development and not for production.
  4. Consider restructuring your development environment
    • Development folder with _posts containing just a sample
    • Production folder with your live set of _posts
    • copy you dev content over prior to production build
Jay Byford-Rew
  • 5,736
  • 1
  • 35
  • 36
0

The profiling was showing nothing to worry about, but I was still getting 2-3 seconds regeneration times with a simple one page website.

I used a super simple Gemfile

source 'https://rubygems.org'
ruby "2.4.2"

gem "jekyll", "~> 3.6.2"

Then called bundle install again.

After that, regeneration times were back under 1 second.

Emile Bergeron
  • 17,074
  • 5
  • 83
  • 129