Hugo Binary Huge (no pun intended)

Can any dev tell me why the linux amd64 binary is 28.7 MB in size?

Deployment is be easier the smaller the binary is (enabling me to create a smaller docker image as well).

Thanks for your input on this topic!

How is that compared to Jekyll or Gatsby?

A larger binary with no dependencies or a smaller binary with dependecies?

That’s what you’re really asking.

I am not a dev. But in the past I won the t-shirt of dependency hell (ruby gems, npm etc)

Now thanks to Hugo, that t-shirt is chucked away in a dark corner somewhere and I don’t plan on wearing it ever again…

This is not something we’re going to do anything about. But it is an interesting discussion if you turn it around.

▶ file hugo
hugo: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, stripped

The above is the Linux amd64 binary. So it is stripped, but statically linked so it can be run on any container. Go has gotten some critique for somewhat larget binaries compared to their C counterparts, but flexibility comes at a slight cost.

We could have made the binary smaller by dynamically linking it, but that would break many people’s use of it.

I tested the blog demo of a JavaScript (npm based) static site generator some time ago. I counted 1500 JS libraries in my node_modules folder (not counting the tool itself and its global dependencies).

In this area, Hugo is a dream tool.

3 Likes

Amen to that.

1 Like

Thanks for your input, I never wanted to say Hugo is anything but awesome!

Actually being statically linked and the huge amount of dependencies that are shipped inside the binary are good points.

Keep doing this great work on it!

1 Like