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)