From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id UAA03690; Wed, 12 Nov 2003 20:05:32 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id UAA03835 for ; Wed, 12 Nov 2003 20:05:30 +0100 (MET) Received: from herd.plethora.net (herd.plethora.net [205.166.146.1]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id hACJ5T104736 for ; Wed, 12 Nov 2003 20:05:29 +0100 (MET) Received: from bhurt.plethora.net (bhurt.plethora.net [205.166.146.49]) by herd.plethora.net (8.11.6/8.10.1) with ESMTP id hACJ4nC02210; Wed, 12 Nov 2003 13:04:49 -0600 (CST) Date: Wed, 12 Nov 2003 14:03:35 -0600 (CST) From: Brian Hurt X-X-Sender: bhurt@localhost.localdomain To: Sven Luther cc: Richard Jones , John J Lee , Subject: Re: [Caml-list] Executable size? In-Reply-To: <20031112183858.GB16395@iliana> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 sven:01 luther:01 simplistic:01 dynamically:01 statically:01 3.07:01 printf:01 printf:01 ocamlc:01 ocamlc:01 ocamlopt:01 usr:01 ocamlrun:01 usr:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Wed, 12 Nov 2003, Sven Luther wrote: > > 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 > > Mmm (on i386 and with 3.07+2) : > > $ cat hello.ml > Printf.printf "Hello World!\n" > $ ocamlc hello.ml -o hello.byte > $ ls -l hello.byte > 36025 hello.byte > $ ocamlc hello.ml -custom -o hello.custom > $ ls -l hello.custom > 181718 hello.custom > $ ocamlopt hello.ml -o hello.native > $ ls -l hello.native > 149877 hello.native > > That said : > > $ cat hello > #!/usr/bin/ocamlrun /usr/bin/ocaml > Printf.printf "Hello World!\n";; > $ ls -l hello > 68 hello > i386 (Athlon 2200+, actually), Redhat 9.0 and Ocaml 3.07 unpatched: $ cat temp2.ml let _ = print_string "Hello, world!";; $ ocamlopt -o temp2 temp2.ml $ ls -l temp2 -rwxrwxr-x 1 bhurt bhurt 112213 Nov 12 13:48 temp2 $ cat temp3.c #include int main (void) { puts("Hello, world!"); return 0; } $ gcc -Os -o temp3 temp3.c $ ls -l temp3 -rwxrwxr-x 1 bhurt bhurt 11228 Nov 12 13:49 temp3 $ Using printf brings in most of the printf library, and adds about 40K to the size of the executable. But you only ever need to include it once. Doing an ls -l `ocamlc -where`/*.cma shows at most about a meg of total libraries to include everything in the standard library (I'm assuming that the 988K toplevellib.cma is only needed by the top level). If I was willing to let my code out, and download size was important, and I didn't mind requiring my users to have a compiler/interpreter for the language installed, then I'd be inclined to just ship bzipped source code tarballs around. Maybe with a little compile/install script bundled. That way you don't have to ship around the libraries at all, and source code tends to be smaller than binary executables, and compresses a lot better than equivelent executables (source code should get at least 10:1 compression- playing with compressing Ocaml executables I'm only getting about 5:2 compression). That being said, binary executables- especially binary executables with any special libraries they need statically linked- have the advantage of the making the client need to preinstall as little as possible. > Friendly, > > Sven Luther > > ------------------- > 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 > -- "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 Brian ------------------- 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