{"id":1303,"date":"2025-10-03T00:00:00","date_gmt":"2025-10-02T22:00:00","guid":{"rendered":"https:\/\/demo.sidekick.be\/itenium\/jekyll-serve-performance\/"},"modified":"2025-11-28T13:31:40","modified_gmt":"2025-11-28T12:31:40","slug":"jekyll-serve-performance","status":"publish","type":"post","link":"https:\/\/demo.sidekick.be\/itenium\/blog\/ruby\/jekyll-serve-performance\/","title":{"rendered":"Performance optimization for &#8216;bundle exec jekyll serve&#8217;"},"content":{"rendered":"<h1 id=\"upgrade-jekyll\">Upgrade Jekyll<\/h1>\n<p>Upgrading Jekyll from v3.9.0 to 4.2.2 already brought the reload time down from <strong>20s to 12s<\/strong>.<\/p>\n<p>After updating the <code>Gemfile<\/code>, I also had to upgrade a few other gems:<\/p>\n<pre><code class=\"language-txt\">gem \"jekyll\", \"4.2.2\"\n\ngroup :jekyll_plugins do\n  gem \"kramdown-parser-gfm\"\n  gem \"jekyll-feed\", \"~&gt; 0.17\"\n  gem \"jekyll-paginate\", \"~&gt; 1.1.0\"\n  gem \"jemoji\", \"~&gt; 0.13.0\"\n  gem \"jekyll-gist\", \"~&gt; 1.5.0\"\n  gem \"jekyll-avatar\", \"~&gt; 0.8.0\"\n  gem \"jekyll-redirect-from\"\nend\n<\/code><\/pre>\n<p>And then apply the changes with <code>bundle update<\/code>.<\/p>\n<p>There probably isn\u2019t much you have to do when <a href=\"https:\/\/jekyllrb.com\/docs\/upgrading\/3-to-4\/\">upgrading from v3 to v4<\/a>.<\/p>\n<ul>\n<li><code>ruby -v<\/code> needs to be &gt;=2.7.0<\/li>\n<li><code>{{ site.baseurl }}\/{% post_url some-post %}<\/code> -&gt; <code>{% post_url some-post %}<\/code><\/li>\n<\/ul>\n<h1 id=\"incremental-serving\">Incremental Serving<\/h1>\n<p>The next logical step is to only re-render what has actually changed. This reduced reload times from <strong>12s to 3s<\/strong> \ud83c\udf89\ud83e\udd73<\/p>\n<pre><code class=\"language-ps1\">bundle exec jekyll serve --incremental\n\n# or:\nbundle exec jekyll serve -I\n<\/code><\/pre>\n<h2 id=\"caveat\">Caveat<\/h2>\n<p>The <code>--incremental<\/code> will only update file(s) that have actually changed. This means that a new post will not appear in your blog post listing \/ home page because <strong>that<\/strong> file has not changed\u2026<\/p>\n<p>To force an update:<\/p>\n<pre><code class=\"language-ps1\">touch blog\/index.html\n<\/code><\/pre>\n<p>Which works on my Windows system because of this function:<\/p>\n<pre><code class=\"language-ps1\">function touch($file) {\n\tif (Test-Path $file) {\n\t\t(Get-ChildItem $file).LastWriteTime = Get-Date\n\t} else {\n\t\t$Utf8NoBomEncoding = New-Object System.Text.UTF8Encoding $False\n\t\t$path = Get-Location\n\t\t$path = Join-Path -Path $path -ChildPath $file\n\t\t[System.IO.File]::WriteAllText($path, \"\", $Utf8NoBomEncoding)\n\t}\n}\n<\/code><\/pre>\n<p>For pages like that, you can automate this by adding to the front matter:<\/p>\n<pre><code class=\"language-yaml\">regenerate: true\n<\/code><\/pre>\n<h2 id=\"windows-directory-monitor\">Windows Directory Monitor<\/h2>\n<p><a href=\"https:\/\/github.com\/Maher4Ever\/wdm\" class=\"github\"><img decoding=\"async\" src=\"https:\/\/img.shields.io\/github\/stars\/Maher4Ever\/wdm.svg?style=social&amp;label=Star\" \/><\/a><a href=\"https:\/\/github.com\/Maher4Ever\/wdm\">Maher4Ever\/wdm<\/a>: A threaded directories monitor for Windows.<\/p>\n<p>For Windows, you also need to add <code>wdm<\/code> to the <code>Gemfile<\/code>:<\/p>\n<pre><code class=\"language-txt\"># Performance-booster for watching directories on Windows\ngem \"wdm\", \"~&gt; 0.2.0\", :platforms =&gt; [:mingw, :x64_mingw, :mswin]\n<\/code><\/pre>\n<p><code>bundle install<\/code> and you\u2019re ready to go!<\/p>\n<h1 id=\"development-configyml\">Development config.yml<\/h1>\n<p>This can be improved even further by not doing some plugin work that is typically not necessary during development anyway.<\/p>\n<pre><code class=\"language-ps1\">bundle exec jekyll serve --incremental --config _config_dev.yml\n<\/code><\/pre>\n<p>In the copied <code>_config_dev.yml<\/code> I removed all the gems in <code>group :jekyll_plugins do<\/code>.<\/p>\n<p>This however only reduced the reload time by 0.5s which wasn\u2019t worth it for me as I\u2019d have to keep two config.ymls in sync.<\/p>\n<h2 id=\"limit-posts\">Limit Posts<\/h2>\n<p>In the <code>_config_dev.yml<\/code>, you can specify to only render the last x posts. This turned out to be not very useful because the profiler told me that most time is spent on reading and not so much on the rendering phase.<\/p>\n<pre><code class=\"language-yaml\"># While this seems like a super great idea, this no longer makes\n# it possible to use post_url to point to a post that is older..\nlimit_posts: 20\n<\/code><\/pre>\n<h1 id=\"profiling\">Profiling<\/h1>\n<p>If it\u2019s still taking too long, you can use <code>--profile<\/code> to figure out what\u2019s going on.<\/p>\n<pre><code class=\"language-ps1\">bundle exec jekyll serve --profile\n<\/code><\/pre>\n<h1 id=\"powershell-profile\">PowerShell Profile<\/h1>\n<p>I have these added to my <a href=\"\/blog\/dev-setup\/powershell-profiles\/\">ps profile<\/a>, because who wants to remember\/write all the bundle exec etc etc \ud83d\ude00<\/p>\n<pre><code class=\"language-ps1\">function Start-Jekyll {\n\tbundle exec jekyll serve --incremental\n}\nfunction Start-JekyllWithDrafts {\n\tbundle exec jekyll serve --drafts --incremental\n}\nfunction Start-JekyllDev {\n\tbundle exec jekyll serve --incremental --config _config_dev.yml\n}\nfunction Start-JekyllDevWithDrafts {\n\tbundle exec jekyll serve --drafts --incremental --config _config_dev.yml\n}\n\nSet-Alias bejs Start-Jekyll\nSet-Alias bejsd Start-JekyllWithDrafts\nSet-Alias bejsdev Start-JekyllDev\nSet-Alias bejsddev Start-JekyllDevWithDrafts\n<\/code><\/pre>\n<h1> Package Versions <i class=\"fa fa-info-circle\" style=\"float: right; color: cornflowerblue; font-size: 28px\" title=\"Package versions used for this post and in the accompanying code on Github\"><\/i><\/h1>\n<div><a href=\"https:\/\/github.com\/jekyll\/jekyll\" class=\"github\"><img decoding=\"async\" src=\"https:\/\/img.shields.io\/github\/stars\/jekyll\/jekyll.svg?style=social&#038;label=Star\" \/><\/a><a href=\"https:\/\/github.com\/jekyll\/jekyll\">jekyll\/jekyll<\/a>: v4.2.2 <\/div>\n","protected":false},"excerpt":{"rendered":"<p>Every change to a blog post on this website took a whopping 20 second delay before I could see the result.<\/p>\n<p>The <a href=\"https:\/\/talk.jekyllrb.com\/t\/exclude-jekyll-feed-in-development-environment\/2681\/4\">solution<\/a> was really simple, really. And was committed in the README as a TODO over 3 years ago.<\/p>\n","protected":false},"author":1,"featured_media":1937,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[8],"tags":[9,10,7],"class_list":["post-1303","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ruby","tag-powershell","tag-war-story","tag-windows"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Performance optimization for &#039;bundle exec jekyll serve&#039; - Itenium<\/title>\n<meta name=\"robots\" content=\"noindex, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Performance optimization for &#039;bundle exec jekyll serve&#039; - Itenium\" \/>\n<meta property=\"og:description\" content=\"Every change to a blog post on this website took a whopping 20 second delay before I could see the result.The solution was really simple, really. And was committed in the README as a TODO over 3 years ago.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/demo.sidekick.be\/itenium\/blog\/ruby\/jekyll-serve-performance\/\" \/>\n<meta property=\"og:site_name\" content=\"Itenium\" \/>\n<meta property=\"article:published_time\" content=\"2025-10-02T22:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-11-28T12:31:40+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/demo.sidekick.be\/itenium\/wp-content\/uploads\/2025\/11\/jekyll-performance.png\" \/>\n\t<meta property=\"og:image:width\" content=\"360\" \/>\n\t<meta property=\"og:image:height\" content=\"300\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Usdevelop\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Usdevelop\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/demo.sidekick.be\/itenium\/blog\/ruby\/jekyll-serve-performance\/\",\"url\":\"https:\/\/demo.sidekick.be\/itenium\/blog\/ruby\/jekyll-serve-performance\/\",\"name\":\"Performance optimization for 'bundle exec jekyll serve' - Itenium\",\"isPartOf\":{\"@id\":\"https:\/\/demo.sidekick.be\/itenium\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/demo.sidekick.be\/itenium\/blog\/ruby\/jekyll-serve-performance\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/demo.sidekick.be\/itenium\/blog\/ruby\/jekyll-serve-performance\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/demo.sidekick.be\/itenium\/wp-content\/uploads\/2025\/11\/jekyll-performance.png\",\"datePublished\":\"2025-10-02T22:00:00+00:00\",\"dateModified\":\"2025-11-28T12:31:40+00:00\",\"author\":{\"@id\":\"https:\/\/demo.sidekick.be\/itenium\/#\/schema\/person\/6ab401ce01e858184ee4a8667fe0f022\"},\"breadcrumb\":{\"@id\":\"https:\/\/demo.sidekick.be\/itenium\/blog\/ruby\/jekyll-serve-performance\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/demo.sidekick.be\/itenium\/blog\/ruby\/jekyll-serve-performance\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/demo.sidekick.be\/itenium\/blog\/ruby\/jekyll-serve-performance\/#primaryimage\",\"url\":\"https:\/\/demo.sidekick.be\/itenium\/wp-content\/uploads\/2025\/11\/jekyll-performance.png\",\"contentUrl\":\"https:\/\/demo.sidekick.be\/itenium\/wp-content\/uploads\/2025\/11\/jekyll-performance.png\",\"width\":360,\"height\":300,\"caption\":\"Dr Jekyll (from Mr Hyde) serving websites at light speed, silver tray with holographic sites materializing instantly, Victorian steampunk aesthetic mixed with cyberpunk technology, gears turning at impossible velocities --ar 6:5\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/demo.sidekick.be\/itenium\/blog\/ruby\/jekyll-serve-performance\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/demo.sidekick.be\/itenium\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Performance optimization for &#8216;bundle exec jekyll serve&#8217;\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/demo.sidekick.be\/itenium\/#website\",\"url\":\"https:\/\/demo.sidekick.be\/itenium\/\",\"name\":\"Itenium\",\"description\":\"We build software. We build careers.\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/demo.sidekick.be\/itenium\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/demo.sidekick.be\/itenium\/#\/schema\/person\/6ab401ce01e858184ee4a8667fe0f022\",\"name\":\"Usdevelop\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/demo.sidekick.be\/itenium\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/cc8cf9b9e9d5bbe7e8d247907cc9ac8457bbfa2854b52eaddf6529adfe88ceab?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/cc8cf9b9e9d5bbe7e8d247907cc9ac8457bbfa2854b52eaddf6529adfe88ceab?s=96&d=mm&r=g\",\"caption\":\"Usdevelop\"},\"sameAs\":[\"https:\/\/demo.sidekick.be\/itenium\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Performance optimization for 'bundle exec jekyll serve' - Itenium","robots":{"index":"noindex","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"og_locale":"en_US","og_type":"article","og_title":"Performance optimization for 'bundle exec jekyll serve' - Itenium","og_description":"Every change to a blog post on this website took a whopping 20 second delay before I could see the result.The solution was really simple, really. And was committed in the README as a TODO over 3 years ago.","og_url":"https:\/\/demo.sidekick.be\/itenium\/blog\/ruby\/jekyll-serve-performance\/","og_site_name":"Itenium","article_published_time":"2025-10-02T22:00:00+00:00","article_modified_time":"2025-11-28T12:31:40+00:00","og_image":[{"width":360,"height":300,"url":"https:\/\/demo.sidekick.be\/itenium\/wp-content\/uploads\/2025\/11\/jekyll-performance.png","type":"image\/png"}],"author":"Usdevelop","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Usdevelop","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/demo.sidekick.be\/itenium\/blog\/ruby\/jekyll-serve-performance\/","url":"https:\/\/demo.sidekick.be\/itenium\/blog\/ruby\/jekyll-serve-performance\/","name":"Performance optimization for 'bundle exec jekyll serve' - Itenium","isPartOf":{"@id":"https:\/\/demo.sidekick.be\/itenium\/#website"},"primaryImageOfPage":{"@id":"https:\/\/demo.sidekick.be\/itenium\/blog\/ruby\/jekyll-serve-performance\/#primaryimage"},"image":{"@id":"https:\/\/demo.sidekick.be\/itenium\/blog\/ruby\/jekyll-serve-performance\/#primaryimage"},"thumbnailUrl":"https:\/\/demo.sidekick.be\/itenium\/wp-content\/uploads\/2025\/11\/jekyll-performance.png","datePublished":"2025-10-02T22:00:00+00:00","dateModified":"2025-11-28T12:31:40+00:00","author":{"@id":"https:\/\/demo.sidekick.be\/itenium\/#\/schema\/person\/6ab401ce01e858184ee4a8667fe0f022"},"breadcrumb":{"@id":"https:\/\/demo.sidekick.be\/itenium\/blog\/ruby\/jekyll-serve-performance\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/demo.sidekick.be\/itenium\/blog\/ruby\/jekyll-serve-performance\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/demo.sidekick.be\/itenium\/blog\/ruby\/jekyll-serve-performance\/#primaryimage","url":"https:\/\/demo.sidekick.be\/itenium\/wp-content\/uploads\/2025\/11\/jekyll-performance.png","contentUrl":"https:\/\/demo.sidekick.be\/itenium\/wp-content\/uploads\/2025\/11\/jekyll-performance.png","width":360,"height":300,"caption":"Dr Jekyll (from Mr Hyde) serving websites at light speed, silver tray with holographic sites materializing instantly, Victorian steampunk aesthetic mixed with cyberpunk technology, gears turning at impossible velocities --ar 6:5"},{"@type":"BreadcrumbList","@id":"https:\/\/demo.sidekick.be\/itenium\/blog\/ruby\/jekyll-serve-performance\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/demo.sidekick.be\/itenium\/"},{"@type":"ListItem","position":2,"name":"Performance optimization for &#8216;bundle exec jekyll serve&#8217;"}]},{"@type":"WebSite","@id":"https:\/\/demo.sidekick.be\/itenium\/#website","url":"https:\/\/demo.sidekick.be\/itenium\/","name":"Itenium","description":"We build software. We build careers.","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/demo.sidekick.be\/itenium\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/demo.sidekick.be\/itenium\/#\/schema\/person\/6ab401ce01e858184ee4a8667fe0f022","name":"Usdevelop","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/demo.sidekick.be\/itenium\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/cc8cf9b9e9d5bbe7e8d247907cc9ac8457bbfa2854b52eaddf6529adfe88ceab?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/cc8cf9b9e9d5bbe7e8d247907cc9ac8457bbfa2854b52eaddf6529adfe88ceab?s=96&d=mm&r=g","caption":"Usdevelop"},"sameAs":["https:\/\/demo.sidekick.be\/itenium"]}]}},"_links":{"self":[{"href":"https:\/\/demo.sidekick.be\/itenium\/wp-json\/wp\/v2\/posts\/1303","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/demo.sidekick.be\/itenium\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/demo.sidekick.be\/itenium\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/demo.sidekick.be\/itenium\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/demo.sidekick.be\/itenium\/wp-json\/wp\/v2\/comments?post=1303"}],"version-history":[{"count":2,"href":"https:\/\/demo.sidekick.be\/itenium\/wp-json\/wp\/v2\/posts\/1303\/revisions"}],"predecessor-version":[{"id":2133,"href":"https:\/\/demo.sidekick.be\/itenium\/wp-json\/wp\/v2\/posts\/1303\/revisions\/2133"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/demo.sidekick.be\/itenium\/wp-json\/wp\/v2\/media\/1937"}],"wp:attachment":[{"href":"https:\/\/demo.sidekick.be\/itenium\/wp-json\/wp\/v2\/media?parent=1303"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/demo.sidekick.be\/itenium\/wp-json\/wp\/v2\/categories?post=1303"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/demo.sidekick.be\/itenium\/wp-json\/wp\/v2\/tags?post=1303"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}