English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

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: 2003-11-12 (18:07)
From: Brian Hurt <bhurt@s...>
Subject: Re: [Caml-list] Executable size?
On Wed, 12 Nov 2003, Richard Jones wrote:

> On Wed, Nov 12, 2003 at 04:14:54PM +0000, John J Lee wrote:
> > How does O'Caml compare with languages like Haskell (ghc), C and C++ for
> > executable size?  Does compiled code depend on a runtime library (and how
> > big is that, if so)?
> 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
> list about the merits and problems with linking the runtime
> dynamically.

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.

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.  But in my experience 
(depending upon the program), Ocaml gets a lot more code reuse, and thus 
can actually lead to smaller executables.

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

"Usenet is like a herd of performing elephants with diarrhea -- massive,
difficult to redirect, awe-inspiring, entertaining, and a source of
mind-boggling amounts of excrement when you least expect it."
                                - Gene Spafford 

To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners