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 UAA00575; Tue, 9 Jul 2002 20:20:26 +0200 (MET DST) 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 UAA00566 for ; Tue, 9 Jul 2002 20:20:25 +0200 (MET DST) Received: from web10706.mail.yahoo.com (web10706.mail.yahoo.com [216.136.130.214]) by nez-perce.inria.fr (8.11.1/8.11.1) with SMTP id g69IKOH17641 for ; Tue, 9 Jul 2002 20:20:24 +0200 (MET DST) Message-ID: <20020709182022.69599.qmail@web10706.mail.yahoo.com> Received: from [216.69.69.135] by web10706.mail.yahoo.com via HTTP; Tue, 09 Jul 2002 11:20:22 PDT Date: Tue, 9 Jul 2002 11:20:22 -0700 (PDT) From: Shannon --jj Behrens Subject: Re: [Caml-list] productivity improvement To: Basile STARYNKEVITCH , Oleg Cc: caml-list@inria.fr In-Reply-To: <15658.56034.306342.892408@is002254.saclay.cea.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > Oleg> What are the _simplest_ examples that > demonstrate > Oleg> considerable (> 2:1) O'Caml vs C++ > productivity improvement > Oleg> (in terms of program size) and where can I > find them? I wrote a bunch of programs comparing several languages using two different algorithms ("Simple" and "Modcount") for finding primes. Eventually, I hope to throw these up on a Web page, but here is a summary of the results: Simple: C: Source: 76 lines Binary: 5833 bytes Sample Run: 1.56 seconds Cyclone: Source: 63 lines Binary: 127264 bytes Sample Run: 1.63 seconds Ocaml: Source: 35 lines Binary: 138726 bytes Sample Run: 3.57 seconds Python: Source: 28 lines Binary: 1629 bytes Sample Run: 13.6 seconds ModCount: C: Source: 95 lines Binary: 6020 bytes Sample Run: 1.08 seconds Cyclone: Source: 83 lines Binary: 127391 bytes Sample Run: 1.35 seconds Ocaml: Source: 54 lines Binary: 139091 bytes Sample Run: 3.66 seconds Python: Source: 44 lines Binary: 4054 bytes Sample Run: 91.8 seconds Line counts do not include blank lines or comments. Sample runs were calculated using "time ./executable 5000". Ocaml programs where compiled using the native compiler. Python binary sizes were taken from .pyo's which still require the Python interpretter. My friend did a Java version. It required more lines of code that OCAML, and was slightly slower. I don't have the exact numbers, so I haven't written them here. :( Here are some of the things that I learned: 1) C is the fastest (of course). 2) Python requires the fewest lines of code. 3) Ocaml provides (in my mind) the best ratio of execution speed per lines of code. 4) I don't agree that having a higher level language will often result in using better algorithms, which compensate for the language overhead. I have the code of the programs, if you wish. Best Regards, -jj __________________________________________________ Do You Yahoo!? Sign up for SBC Yahoo! Dial - First Month Free http://sbc.yahoo.com ------------------- 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