How to speed up Jekyll/Octopress generation?
Asked Answered
A

6

8

I'm using Octopress as my blog engine. It's perfect. But if there are many posts, for example 400+ posts, the speed of generation is soooo slow.

So, is there any way to speed up Jekyll/Octopress generation?

Thanks.

Ambition answered 4/11, 2012 at 9:20 Comment(2)
I'd love to know this, too! But I already know what isolate and integrate does, so hopefully someone will post an answer how to generate only the new stuff with the generate command!Varlet
I use Jekyll instead of Octopress, but have come up with a process that helps speed up editing and design changes. The idea is to work on a sub set of files that can generate quickly and only generate the full set just before deployment. The same approach might work for Octopress. You can see my full description of the process here: https://mcmap.net/q/1024264/-shorten-page-generation-time-for-local-jekyll-serverDeckhand
W
3

Obviously if you are just working on one post, there is no need to wait for the entire site to generate. What you are looking for is the rake isolate[partial_post_name] task.
Using rake isolate, you can “isolate” only that post you are working on and move all the others to the source/_stash folder. The partial_post_name parameter is just some words in the file name for the post. For example, if I want to isolate the post from the earlier example, I would use

rake isolate[plain-english]  

This will move all the other posts to source/_stash and only keep the 2011-09-29-just-type-the-title-of-the-post-here-in-plain-english.markdown post in source/_posts. You can also do this while you are running rake preview. It will just detect a massive change and only regenerate that one post from then on.

by @Pavan Podila
More Info: Tips for Speeding Up Octopress Site Generation

2013.01.08 update:
Hexo--A fast, simple & powerful blog framework, powered by Node.js.
Features:Incredibly fast - generate static files in a glance

2013.6.20 update:
gor -- A static websites and blog generator engine written in Go
gor has following awesome benefits: 1. Speed -- Less than 1 second when compiling all my near 200 blogs on wendal.net 2. Simple -- Only one single executable file generated after compiling, no other dependence

Whalebone answered 5/11, 2012 at 2:23 Comment(3)
I think this is only a partially answer on the question. For sure, nothing is wrong what you said, but your answer does not explain how to compile the complete site, without compiling the stuff which is already compiled. I'd love to know this, too!Varlet
@Varlet hi,you can try to use hexo,A fast, simple & powerful blog framework, powered by Node.js.Incredibly fast - generate static files in a glance.Whalebone
@Varlet try gor -- A static websites and blog generator engine written in Go.github.com/wendal/gorWhalebone
O
1

Install Ruby GSL

gem install gsl 

You should notice a speed increase.

Overweight answered 26/11, 2012 at 20:30 Comment(4)
Can you explain why? What does jekyll use from gsl?Imbalance
I agree, can you explain? Also this gem install fails.Cotenant
Jekyll's "related posts" uses latent semantic indexing, provided by Classifier::LSI. To do so, it uses vector analysis features, which can be accelerated by (a Ruby wrapper of) GSL, the GNU Scientific Library. If GSL isn't available, a pure-Ruby implementation is used, but it's exceptionally slow for big sites, and using GSL improves performance ~10x.Gillett
should notice? Do you have reasons why this works? Do I just use jekyll build after without extra flags?Rachele
H
1

hexo powered by Node.js. I am using it, much faster than Octopress. And it provides a simple way to migrate your articles to hexo very easily.

Highchair answered 22/1, 2013 at 3:33 Comment(2)
hexo is indeed very fast. I switched from DocPad to hexo because of speed: #17176594Trantham
hexo is great, but migration is not for me. Some markdown are not supported.Suprarenal
I
1

You can generate only one post while you are writing it using

rake isolate[your-post]

and then

rake integrate

to go back to normal.

To fully answer your question, you can't generate only one post. You can see Octopress' Issue #395 on that subject, which explains that this is due to a limitation on Jekyll's side.

Interpolation answered 11/2, 2013 at 9:20 Comment(0)
P
0

Reached this post with the same problem, but then did not quite like the idea of rake isolate. Also the inbuilt task does not integrate with the _drafts workflow. So what I ended up using is to create a custom config.yml with the _posts folder excluded (using exclude) and have only the drafts folder built. You can pass in a different config file as command line parameter to jekyll. I just used this when actively writing new posts and while publish use the same old approach (which still does take some time). This approach builds only the draft post and I am good with that.

jekyll build --watch --drafts --config _previewconfig.yml

For those interested in the complete worklow take a look here

Presbyterate answered 20/1, 2016 at 12:41 Comment(0)
P
0

If your blog has a lot of images (and other static assets that do not change between builds), it is worthwhile to exclude them from Jekyll's build process, and instead manually update them as needed.

For whatever reason, Jekyll build is not intelligent when it comes to handling such assets. It will delete everything in the public folder, and re-copy the contents in source every time you build. This is wasteful if the assets haven't changed. This can be avoided by using a tool such as Robocopy (Windows) or Rsync (Linux) that is able to update only what has changed.

To tell Jekyll to ignore a folder, add the following to _config.yml:

exclude:     # exclude from build
  - folderPath
keep-files:  # do not delete/empty copy in `public`
  - folderPath

Then elsewhere, use whatever tool you want to update the folder.


For more things you can try, see this post.

Protostele answered 18/8, 2020 at 21:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.