Browse thread
[Caml-list] productivity improvement
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Shannon --jj Behrens <jjinux@y...> |
| Subject: | Re: [Caml-list] productivity improvement |
> 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