As it seems, the release build is not optimized.

Here are two options I would propose for the release build:

lto = true
codegen-units = 1

I just ran some test generations of Zola’s docs with those options.

One thing to note upfront is that the build of Zola with those options (thanks to LTO) takes considerably longer. On my computer it was an increase of about 40%.

Now for the positive effect. The binary size dropped from 24.7MB to 17.5MB. That is definitely a big win. For build time of the site, I can’t really give some numbers, they just vary to much. But one could think that overall they should get better. That’s what optimizations are about, after all. Maybe one could do some larger test to investigate this.

Now, the longer build time might be a drawback. But as this only applies to release builds (and therefore does not effect the development workflow), I don’t see why one should not take the benefit of a smaller and probably faster binary.

What do you think?

Thanks for the info!
I’ve tried it locally and it seems to be slightly faster overall. On a test blog of 100k pages, the current version renders it in ~59s and with those options in ~55s.
I’ll add them for the next release and see if it doesn’t timeout in CIs.

1 Like