News for hackers. Stuff that matters.
Re:Hello World Executable Sizes in 18 Languages by Zak on Wednesday January 28, 2009 @04:36AM (#453555)
In some of these cases, I suspect the main difference is related to how the language's runtime libraries are linked to the executable. Chicken, for example produces a 15k executable. Running that executable requires the presence of a much larger dynamically linked libchicken.

As mentioned in the article, an executable SBCL core includes all of SBCL. Considering that Java and .NET produce "executables" that are actually executed by their respective runtimes, I think it might be more fair to SBCL to compare the size of a FASL. It's 828 bytes for a FASL compiled from

    (print "Hello, world!")
    (sb-ext:quit)
Re:Hello World Executable Sizes in 18 Languages by jwr on Wednesday January 28, 2009 @07:11AM (#453655)
This is a very silly comparison. What is an executable? Do you consider dynamic libraries that it uses a part of it? Do you consider the language runtime a part of it?

As an example, 12K for java is a ridiculous number. What's the size of the runtime required to run it? I bet it is larger than the 25MB for Common Lisp, but it doesn't get counted -- why?

And if you're there, you need to define what your base runtime is -- is it the OS kernel? OS kernel + a set of base dynamic libraries? If so, which ones? Is glibc standard? glib? zlib?

Re:Hello World Executable Sizes in 18 Languages by gertburger on Wednesday January 28, 2009 @02:30AM (#453473)
It seem like the author does not differentiate between compiled (To machine code) and (To intermediate/byte code). Does that mean the pyc(114 bytes on my machine) generated by python for 'print "Hello world"' can be compared to the others?

It is still interesting though.

Re:Hello World Executable Sizes in 18 Languages by aniketh on Wednesday January 28, 2009 @08:06AM (#453705)
don't forget you would have to add a shebang line to make it truly executable
Re:Hello World Executable Sizes in 18 Languages by smcdow on Wednesday January 28, 2009 @03:41PM (#454511)
Not really:

$ echo 'echo $0' > 'Hello, world!' $ chmod +x 'Hello, world!' $ 'Hello, world!' Hello, world! $ wc 'Hello, World!' 1 2 8 Hello, world!

8 bytes. I think that's probably as small as you can get.

Re:Hello World Executable Sizes in 18 Languages by smcdow on Wednesday January 28, 2009 @03:43PM (#454526)
Oh, brother, formatting.<p> <pre> $ echo 'echo $0' > 'Hello, world!' $ chmod +x 'Hello, world!' $ 'Hello, world!' Hello, world! $ wc 'Hello, World!' 1 2 8 Hello, world! </pre>
Re:Hello World Executable Sizes in 18 Languages by jws on Wednesday January 28, 2009 @12:14AM (#453355)
It would be interesting to also see how much RAM was used to run Hello World, but then I'd want to also know how much was shared with other programs, shared between instances of this program, and not shared... it would probably get out of hand.
Re:Hello World Executable Sizes in 18 Languages by huhtenberg on Wednesday January 28, 2009 @03:08AM (#453498)
The size of D executable - 230K - is a quite big surprise.
Re:Hello World Executable Sizes in 18 Languages by statictype on Wednesday January 28, 2009 @06:00AM (#453604)
> Common Lisp - 25MB

Double-You Tee Eff.

What, does Common Lisp not have an incremental linker or something? Even Delphi executables are never that big.

>Lisp has the largest executable file (because to create an executable, you have to dump a "core image") at 25MB

Can someone explain what this means? I'm clueless.

Re:Hello World Executable Sizes in 18 Languages by mqt on Wednesday January 28, 2009 @06:12AM (#453613)
lispm, from reddit:

    There are different strategies to create CL applications.  
    
    - save an executable image. This will mostly dump the Lisp system and
    when you start it up, you have mostly everything back. The size
    of the dumped image depends on the size of your Lisp system. SBCL
    is already large and does not have any special features to make
    it smaller. CLISP for example writes much smaller images than
    SBCL. Clozure CL is also smaller. Here also is important with how
    much debug information the original Lisp image was created. The
    saved image typically will include all that. Corman CL on Windows
    compresses the Lisp data to save space. 
    
    - deliver an application. That's for example what LispWorks and
    Allegro CL can do. They allow functionality and
    information (debug info, documentation strings, arglists, source
    locations, symbols, caches, ...) to be removed (for example by
    treeshaking, or by removing whole functionality groups). The size
    of the generated application will depend on what you leave out
    and which delivery level you are choosing. Stuff that might not
    be needed: compiler, debugger, disassembler, editor, inspector,
    REPL, ...
    
    - deliver a static application. I don't know which currently
    maintained CL implementation does that. There were several Common
    Lisp implementations that generate 'small' and static C code from
    Lisp. CLICC, Ibuki's CONS, WCL, Lisp-to-C, ThinLisp were in that
    league. They were used for application delivery, where the
    application might be really small and does not have any large
    runtime or development environment.
    
    There are also some other options. Probably ABCL could generate a
    JAR file that could be started with an installed JVM. Often Lisp
    compilers can compile code to native code compiled files (fasls)
    and even can append several fasls into one. Then one does need
    only to ship the fasl file, given that the user has the a Lisp
    installed that can load the fasl.
http://www.reddit.com/r/programming/comments/7swzs/hello_wor...
Re:Hello World Executable Sizes in 18 Languages by jwr on Wednesday January 28, 2009 @07:14AM (#453658)
This means the original author is clueless. Executable for my small CL program is 44K for the FASL file and a one-liner shell script to run it. This is very similar to the java numbers.

The original author chose to dump the entire development environment including the compiler, into one single executable -- this is sometimes interesting, but I don't see why he did that. He doesn't seem to do it for Java or Python.

Re:Hello World Executable Sizes in 18 Languages by TrevorJ on Wednesday January 28, 2009 @03:41PM (#454512)
I'd like to see the code for "Hello World" for biological systems.
Re:Hello World Executable Sizes in 18 Languages by smcdow on Wednesday January 28, 2009 @03:39PM (#454467)
It can be done in 8 bytes.