From: Andries Hekstra <andries.hekstra@philips.com>
To: Caml Mailing List <caml-list@yquem.inria.fr>
Subject: Comparison between original OCAML program and its conversion to C++
Date: Tue, 22 Aug 2006 13:07:12 +0200 [thread overview]
Message-ID: <OF4AB1EDDA.AA571DF4-ONC12571D2.003C1DCC-C12571D2.003D2185@philips.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1535 bytes --]
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)
[-- Attachment #2: Type: text/html, Size: 1861 bytes --]
next reply other threads:[~2006-08-22 11:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-22 11:07 Andries Hekstra [this message]
2006-08-22 23:09 ` [Caml-list] " Corey O'Connor
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=OF4AB1EDDA.AA571DF4-ONC12571D2.003C1DCC-C12571D2.003D2185@philips.com \
--to=andries.hekstra@philips.com \
--cc=caml-list@yquem.inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox