Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Executable size?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: John J Lee <jjl@p...>
Subject: Re: [Caml-list] Executable size?
On Wed, 12 Nov 2003, Brian Hurt wrote:

> On Wed, 12 Nov 2003, Richard Jones wrote:
> > This is not a criticism of OCaml, but the executables do tend to be
> > quite large. This seems mainly down to the fact that OCaml links the
> > runtime library in statically. There was previous discussion on this
> This isn't as bad as it sounds.  A simplistic "hello world!" application
> in Ocaml weighs in at 112K, versus 11K for the equivelent (dynamically
> linked) C program- almost entirely either statically linked standard
> libraries and infrastructure (garbage collections, etc.)- stuff that
> doesn't expand with larger programs.

OK.  Is that 100K difference for "hello world" (which doesn't necessarily
stay the same for larger programs, as you say below) simply a result of
the fact that C has the "unfair" advantage of already having its runtime
sitting on everyone's hard drive already?

> A naive assumption would be that an Ocaml program is about 100K or so
> larger than the equivelent C program.  Not much, considering how easy it
> is to get executables multiple megabytes in size.

> Ocaml gets a lot more code reuse, and thus can actually lead to smaller
> executables.

I don't understand what you mean by that (probably my fault).  What do you
mean by "code reuse" here?  I usually understand that phrase to mean using
code written by people other than me, but you seem to mean it in a
different sense.

> Unless you have special constraints, the difference between C program
> sizes and Ocaml program sizes are not enough to be worth worrying about.

I don't really agree that the problem of distributing simple (few lines of
code) applications in small executables is all that "special".  Certainly
there are *many* applications where you don't need that; equally, there
are quite a few where you do need/want that.


To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: