Longstanding issues: structs & standalone Erlang

Richard A. O'Keefe <>
Thu Feb 16 04:04:17 CET 2006

Robert Raschke <> wrote:
	Anyway, this has veered a bit.  I think that the Erlang package at the
	moment is great.  But it is also very large.

I'm not running the current release of Erlang/OTP.
The one I have contains 1707 *.beam files, for a total of about 29MB
of beam file content (ignoring i-node space and wasted space in blocks).
gzip just brings that down to 21MB, but I am sure that a tailored
compression scheme could do much better.

There are 1675 *.[ehy]rl files, for a total of about 23 MB of source
code (including white space and comments).  After stripping out
comments and compressing runs of white space to single characters,
that's just 15MB of source code.  (So stripped source code is *smaller*
than compressed .beam files...)
Stripping and then compressing with gzip -9 reduces the size to just
2.5MB, which is hard to believe, but the result does uncompress to
something plausible.  Clearly it's saving a fair bit across file
boundaries.  For some files, that's not fair; on the other hand, if
you are installing one part of Mnesia, you probably want them all,
so it's actually entirely fair for quite a lot of the files.

Anyway, we have a definite result here:
all of the Erlang source files in a release with 29MB of beam stuff
could be delivered in a single 2.5MB file, which is not _that_ big.
It's rather smaller than the emulator binary, for example.

This introduces the idea of a single executable which contains a
suitable compressed form ("slim binary") of all the library sources
inside itself (without growing much bigger!) and installs the .beam
files as needed.  This strikes me as crazy, but the numbers suggest
that it might be crazy enough to work.

More information about the erlang-questions mailing list