caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Comparison between original OCAML program and its conversion to C++
@ 2006-08-22 11:07 Andries Hekstra
  2006-08-22 23:09 ` [Caml-list] " Corey O'Connor
  0 siblings, 1 reply; 2+ messages in thread
From: Andries Hekstra @ 2006-08-22 11:07 UTC (permalink / raw)
  To: Caml Mailing List

[-- 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 --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Caml-list] Comparison between original OCAML program and its conversion to C++
  2006-08-22 11:07 Comparison between original OCAML program and its conversion to C++ Andries Hekstra
@ 2006-08-22 23:09 ` Corey O'Connor
  0 siblings, 0 replies; 2+ messages in thread
From: Corey O'Connor @ 2006-08-22 23:09 UTC (permalink / raw)
  To: Andries Hekstra; +Cc: Caml Mailing List

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-08-22 23:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-08-22 11:07 Comparison between original OCAML program and its conversion to C++ Andries Hekstra
2006-08-22 23:09 ` [Caml-list] " Corey O'Connor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).