Browse thread
Comparison between original OCAML program and its conversion to C++
-
Andries Hekstra
- Corey O'Connor
[
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: | 2006-08-22 (23:09) |
From: | Corey O'Connor <coreyoconnor@g...> |
Subject: | Re: [Caml-list] Comparison between original OCAML program and its conversion to C++ |
Thanks for the statistics! I would, and probably others, appreciate seeing the actual source of the O'Caml and C++ programs. If it's impossible to share the entire source of both how about just some fragments? -Corey O'Connor On 8/22/06, Andries Hekstra <andries.hekstra@philips.com> wrote: > > Dear CAML mailing list, > > Recently, I have converted by hand, a 3500 line OCAML program simulating an > optical disk system by hand into a C++ program. This is mainly a floating > point program. As the maximum line width varied somewhat in the C++ program > and between the OCAML and the C++ program, line count is not such a good > comparison for program size. Instead I used character count after replacing > all sequences of N spaces by a single space (I did not use tabs). Then, it > turned out that the C++ program was 23% longer. Note that the variable > names, comments, were mostly the same. When I took the original files and > compared zipped file size, the C++ program was 16% larger. > With the C++ program I did not count a brief generic random > generator header file and a longer generic multi-dimensional array with > bound checking using assert statements header file as I could have taken > just standard C++ arrays on the stack. The C++ program (without optimization > and a lot of "as local as possible" variable declaration, similar to OCAML) > was around 10% faster than the OCAML program on an AMD64 platform, when > using g++ to compile the C++ program. > > Regards, > > Andries > > ------------------------------------------------------------------------ > Dr. Ir. Andries P. Hekstra > Philips Research (soon : Philips Semiconductor Research) > High Tech Campus 27 (WL-1-4.15) > 5656 AG Eindhoven > Tel./Fax/Secr. +31 40 27 42048/42566/44051 > > * "Bad software has about 100 hidden bugs ; good software only 10." (C > programming Tutor) > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: > http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > > > -- -Corey O'Connor