Date: Tue, 05 Oct 1999 07:59:37 +1000
From: skaller <firstname.lastname@example.org>
To: Jan Brosius <email@example.com>
Subject: Re: speed versus C
Jan Brosius wrote:
> Hi, is there anything known about the efficiency of compiled Ocaml code
> compared with C/C++
For what it is worth, I am writing an extensive test in the form of
a Python interpreter. C Python is reasonably efficient for certain
operations. The current Ocaml implementation is only 10 times slower
than the C version, running on the pystone benchmark,
and I expect that will be reduced considerably
as I improve the algorithms and data structures.
While an interpreter isn't a benchmark, it is a useful performance
measure because it exercises so much of the language, and in ways
determined partly by the code being interpreted.
It is my guess that, partly due to the higher level nature of ocaml
compared with C, it is possible to encode more optimisations
in the ocaml version than the C version, so that the ocaml
version may even run faster than the C one (simply because
encoding the pattern recognition for the cases in C is
hard to program).
BTW: I would like to see performance (Order) data for library functions.
It is difficult to chose a data structure without knowing
how fast various operations can be expected to perform.
For example, how fast are insertions into Set and Map?
In procedural code, these would be amortized constant time,
or at worst O(log n), by using hashtables or some efficient
tree representation, but the ocaml library versions
are FUNCTIONAL so I have no idea how fast the functional updates
are compared, with say, the in place modification of a hashtable.
-- John Skaller, mailto:firstname.lastname@example.org 1/10 Toxteth Rd Glebe NSW 2037 Australia homepage: http://www.maxtal.com.au/~skaller downloads: http://www.triode.net.au/~skaller
This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:26 MET