Approximity blog home
1 of 1 article InfoSyndicate: full/short

Another myth debunked   28 Jun 05
[print link all ]
Source: groups-beta.google.com/group/comp.lang.lisp/msg/df76d0d07a750854?hl=en
 Mike wrote:
 > What is a smaller lisp implementation that runs on both
 > gnu/linux and windows?

 Let's see, the user will have to install Linux to run the program, but
 the footprint of that program has to be small. :)

 Have you run a system call trace lately on, oh, the ``ls'' program?
 Tons of shared libraries attached. System calls flying left and right.
 A bazillion nonexisten files searched after.

 Linux is not exactly small and lightweight (any  more).

 Here is a comparison between a directory listing and evaluating a
 single expression with CLISP:

 machine:$ strace clisp -norc -q -x '(+ 2 2)' 2>&1 | wc
    260    1963   19729
    machine:$ strace ls /dev/null 2>&1 | wc
        111     870    8225

 It only takes about 2.5 times as many system calls to start up CLISP to
 evaluate an expression than to fetch a directory listing for a single
 file.

 The size of this Lisp system is less than 3 megabytes: a 1.2 meg
 executable and a memory image that is about 1.4 megs.

 Then we add up the shared libraries:
 machine:$ ldd ~/lib/clisp/base/lisp.run | gawk '{ print $3 }' | xargs
 du --total --dereference
 176     /usr/lib/libreadline.so.4
 852     /usr/lib/libncurses.so.5
 16      /lib/libdl.so.2
 1540    /lib/tls/libc.so.6
 20      /usr/lib/libgpm.so.1
 112     /lib/ld-linux.so.2
 2716    total

 The shared libs are as big as the program.  The kernel on this system
 (the uncompresed vmlinux file, not the compressed vmlinuz!) is about
 3.5 megabytes, whoa! Of course, all these executable images have
 run-time storage requirements as well.

 This particular Lisp system is smaller than the kernel, smaller than
 the total size of the shared libraries attached to it, and cranks out
 only about 2.5 as many system calls to evaluate an expression and quit
 as ``ls /dev/null''.

 

Powered by Rublog