I just scrapped all the internal Lua interpeter glue code inside my site generator, and will now just make it run external executables instead.

Pros:

- Do one thing, do it well
- Language choice
- Less complexity for me

Cons:

- You now need more than the single binary to do anything reasonable

Extra:

- I should probably stop calling it a site generator. It doesn't have any concept of HTML anymore.
- I'll probably have a companion binary for the basic tasks expected from a site generator.

% du -sh target/debug/generator
44M target/debug/generator
% cargo clean
% rm Cargo.lock

... fixing some bugs ...

% cargo build
% du -sh target/debug/generator
21M target/debug/generator

... I actually expected all that scripting support code to be more than just half the size...

Update: a "theoretically working" debugging version is 22M.

A release version (+ stripped) is 1.3M.

Using some tricks, I can get it down to just 980K.

If I disable some extra features, however: 368K

I imagine optionally replacing the config serialization lib might let me get even lower, though not entirely sure on that.

Follow

I also wanted to try compiling with musl instead of glibc, but I couldn't get it to work with xargo (sic)

Oh, also I just tried upx, and it got the size down to 172K.

Sign in to participate in the conversation
Mastodon

Server run by the main developers of the project 🐘 It is not focused on any particular niche interest - everyone is welcome as long as you follow our code of conduct!