Re: Efficency in OCaml

From: chet@watson.ibm.com
Date: Wed Sep 01 1999 - 20:40:21 MET DST


From: chet@watson.ibm.com
Message-Id: <199909011840.OAA01846@bismarck.chet.org>
To: Jerome Vouillon <Jerome.Vouillon@inria.fr>
Subject: Re: Efficency in OCaml
Date: Wed, 01 Sep 1999 14:40:21 -0400

Jerome,

Is there a description of the Ocaml object and
"virtual-function-table" format?

Also, well, I think there's been some recent work on analyzing the
path-length of O-O code, and the conclusion has been that in fact,
methods do just "call one other" a lot.

That is, while C code is characterized by lots of tests and longer
path-lengths per function-body, C++ (and Java, *especially* -- geez,
it seems like Java code is all method-calls!) code tends to be short
code-bodies, with branches implemented effectively by calling virtual
functions.

I've had the opportunity to look at a *lot* of Java code in the past
few years, and it displays this trend to an extreme. And to my
horror.

--chet--

>>>>> "JV" == Jerome Vouillon <Jerome.Vouillon@inria.fr> writes:

    JV> The type checking is done at compile time, but method dispatch
    JV> is always dynamic : there is indeed something similar to a
    JV> virtual function table. Therefore, a method invocation is
    JV> rather fast but not as fast as a function call. A great part
    JV> of the cost of method invocation also comes from the fact that
    JV> the method which must be called is not know at compile time
    JV> (function calls are must cheaper in Ocaml when the function is
    JV> known).

    JV> This does not really matters, however, as long as your program
    JV> does not spend its time making method invocations. I think
    JV> this is rare, even in a program making heavy use of objects :
    JV> usually, methods do something, and not just call one another.

    JV> -- Jrme



This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:25 MET