6

I'm migrating my tumblr blog to docpad and have started with this boilerplate: https://github.com/ervwalter/ewalnet-docpad

Now my problem is that "docpad run" takes 58s to run, and a livereload run takes 23s. I wrote the author of this boilerplate and he says he is having the same, but it doesn't bother him too much.

But I don't want to wait half a minute for every change in a blog post to see how it looks like, so I'm trying to make it faster. I tried profiling with nodetime but I don't see a drilldown per method or so. My assumption is that the time is lost in the partials, at it sends the whole posts to the partials

How can I profile Docpad so I see where the time is lost? I know the question is very broad, but all I found on performance optimizing on DocPad is that you should make Docpad not to parse static files.

Update the missing link was that I needed to start the CPU profiler on nodetime:

  1. configure nodetime, described here
  2. start CPU profiler on nodetime
  3. start docpad: docpad --profile run

Unfortunately in my case the output is not much helping. The results of my run reveal that 81% of the time is spent in ambi.js, which seems is just a intermediate layer which calls functions. I could not find out which functions are called, adding console.log(fireMethod.toString()) I only see

function () { [native code] }

so I'm not really further. How can I find out where the time is actually spent? For reference: here is my v8.log

Also, I'm a bit worried, that docpad almost only relies on modules written by Benjamin Lupton. Why is that so?

hansaplast
  • 11,007
  • 2
  • 61
  • 75
  • What was the output of nodetime? I remember the output of v8 profiler was more helpful to me. This question is too broad. If you have ever tried to optimize a program, you would know that there isn't a single trick. You have to measure everything, from the data bound operations, to CPU bound operations. Once you know how much things cost then you can try to optimize it. – Farid Nouri Neshat May 26 '14 at 09:23
  • where do I find the output of nodetime? I just found some graphs about memory/cpu on nodetime.com. I didn't see from the graphs how I would drill down – hansaplast May 26 '14 at 09:27
  • 1
    http://blog.nodetime.com/2012/05/cpu-profiling-with-nodetime.html – Farid Nouri Neshat May 26 '14 at 09:31
  • Ah, I assumed all profiling is visible on nodetime.com but there's also a log file and a client to read it. My problem is that after starting with `docpad --profile run` I don't find any v8.log. http://docpad.org/docs/debug#profiling-with-nodetime says that I should follow the instructions, but there are no instructions in the console – hansaplast May 26 '14 at 10:14
  • update: I found out how to start docpad so it writes `v8.log`: `node --prof node_modules/docpad/bin/docpad --profile run` – hansaplast May 26 '14 at 10:38
  • " but it doesn't bother him too much.",if that's the answer I get from the author of the project I wouldnt even bother using that project.Try to find alternative projects that are faster. – mpm May 30 '14 at 07:46
  • @mpm to clarify: the answer is from the author of the **boilerplate**, not the **project (docpad)** – hansaplast May 30 '14 at 08:36
  • How about checking your [config](http://docpad.org/docs/config)? Maybe you can find there something. Or maybe the code is just bloated. – user568109 Jun 02 '14 at 04:38

2 Answers2

2

After an odyssey of about 1 week I came to the conclusion that Docpad is not made for speed, it is made to handle complex sites. Some facts:

  • even a fresh docpad installation with only twitter bootstrap takes 12s to build
  • there are no means to only regenerate the files which source files have changed (dependency tree), it always regenerates everything
  • reading threads like this show that speed is not in focus

My use case is writing articles for a blog and I have a lot of "change text and see how it looks" loops. I have switched to Hexo which is a lot faster:

  • hexo server starts in 2.5 seconds. With livereload on, when I change a blog post, the broswer tab reloads the page and shows the new content in about 1s
  • generating all files afresh with hexo clean and hexo generate takes only 5s.

This is the same setup (with less, coffeescript, etc.) I had for DocPad where DocPad needed 38s to run.

Additionally to speed hexo gave me

  • themes: hexo nicely separates between the theme and the content (DocPad mingles the two). Currently there are about 30 hexo themes to choose from
  • implementation of read more: in hexo <! --more --> is supported out of the box
  • deployment to github pages is out of the box
  • architecture was a lot easier for me to understand, writing widgets is a bliss, the documentation also looks nicer

Overall, it looks like hexo is suited better for blogs, whereas docpad is better suited for more complex sites. Hexo looks like it's really taking off, getting about 30 stars on github per week, whereas docpad is only getting about 10 stars per week.

hansaplast
  • 11,007
  • 2
  • 61
  • 75
0

you can use meta

standalone: true

while you work on a file. This meta will regenerate only this file if update it. Remove the meta after you finish.

abe
  • 1