[erlang-questions] How small could an Erlang emulator be?

Thomas Lindgren thomasl_erlang@REDACTED
Mon Mar 12 16:31:40 CET 2007


--- Joe Armstrong <erlang@REDACTED> wrote:

> Well before bignums and binaries etc. it was pretty
> small.
> 
> For a long time I struggled to keep the executable
> under 1.4 MB
> so it would fit on one floppy.
> 
> Robert made an Erlang (the Vee) that had a reference
> counting GC
> and it would run happily in 75KB of memory
> (excluding the space for
> the emulator)
> The JAM was designed with a compact byte code.
> 
> So if we threw out bignums and floats and designed a
> very compact object
> code - (huffman) then it could be very small.
> 
> A fun student project (hint)

A basic Prolog emulator can literally fit in the L1
cache of a modern processor -- it's just a handful of
kilobytes of code. But a mature, realistic language
implementation also has a lot of other cruft, not just
bignums and floats.

For example, the largest object files for R10B10 on my
computer are (obj.beam):

erl_db_util.o: 212 KB
beam_load:     204 KB
beam_emu:      199 KB
erl_bif_wrap:  192 KB
bif:           142 KB
inet_drv:      136 KB
hipe_bif0:     125 KB
io:            124 KB
erl_alloc:     119 KB
erl_db_tree:   116 KB
utils:         111 KB
big:           107 KB
erl_db:        103 KB
erl_db_hash:   100 KB
erl_pbifs:      98 KB
...

Eliminating bignums (big.o) looks pretty far down the
list.

(PS. The basis of this was
 dir -l | awk '{print $5, $9 | "sort -n -r"}'
)

Best,
Thomas



 
____________________________________________________________________________________
No need to miss a message. Get email on-the-go 
with Yahoo! Mail for Mobile. Get started.
http://mobile.yahoo.com/mail 



More information about the erlang-questions mailing list