Previous week   Up   Next week
Hello,

Here is the latest Caml Weekly News, week 31 December 2002 to 07
January, 2003.

1) Coyote Gulch test in Caml
2) Native labltk for Mac OS X

======================================================================
1) Coyote Gulch test in Caml
----------------------------------------------------------------------
Some benchmark was discussed on the list (thread starting at
http://caml.inria.fr/archives/200301/threads.html).

Someone asked and Xavier Leroy said:

> Is it normal that my ocaml program is only 2 times faster than the java 
> counterpart ?(using the same method and complied into native. jdk is 1.4.1

You know, many compiler researchers would kill their whole families to
get speedups by a factor of 2 :-)

James Gosling gave a talk at INRIA recently where he repeated the
party line that JDK 1.4 runs as fast, or even faster, than C++.
So, by transitivity, you're implying that OCaml is twice as fast as C++.
Yippee! 

More seriously: Java is nowhere as fast as a good C++ compiler (see
e.g. http://www.coyotegulch.com/reviews/almabench.html for an
independent, cross-language benchmark in numerical computing),
but it's not that slow either.  A factor of 2 slower than ocamlopt
sounds broadly reasonable, especially if the program doesn't stress
the GC too much.  Bagley's shootout (http://www.bagley.org/~doug/shootout/)
seems to suggest a larger factor (JDK 1.3 slightly slower than OCaml
bytecode), but his figures may be lowered by Java's slow start-up times.

Then Chet Murthy asked and Shawn Wagner announced:

> If anybody's ported this to Caml, I'd love to get a copy.

http://raevnos.pennmush.org/code/almabench-ocaml.tar.gz

It's pretty much a straight translation of the C++ version, and not very
impressive speed-wise on my system compared to the C++ one.

To which Xavier Leroy answered:

Thanks a lot for the OCaml translation.  As you say, the speed of the
OCaml version is about 50% of that of the C++ version, both on Athlon
with g++, and on Alpha with the Tru64 cxx compiler.  This is both
reassuring and disappointing:

Reassuring, because our blanket performance statement "OCaml
delivers at least 50% of the performance of a decent C compiler" is
not invalidated :-)

Disappointing, because the assembly code generated by ocamlopt isn't
too ugly despite the code not being very Caml-ish in style.  In  
particular, (almost) all float and ref boxing is correctly eliminated.
Given this, I was expecting maybe 75% of the performances of C++, not
50%.  Simple hand optimization (CSE, loop unrolling) doesn't affect
the speed significantly.  Apparently, the ocamlopt-generated code
offers less instruction-level parallelism than the g++-generated code
for the float computations.  Still, I haven't really understood where
the factor of 2 comes from.

======================================================================
2) Native labltk for Mac OS X
----------------------------------------------------------------------
Ken Wakita announced:
(the patches mentioned in the message are available at
http://caml.inria.fr/archives/200301/msg00029.html)

Today I found some time to install Tcl/Tk for Aqua, which is the native user
interface for Macintosh OS X and configured ocaml-3.06 so that its labltk
links with the Tcl/Tk for Aqua.

labltk, ocamlbrowser, and accompanying examples (hello, eyes, tetris, ...)
under otherlibs/labltk/examples_labltk compiles with little problem.

With a small effort you could make a clickable native application for Mac OS
X.

Though behavior of some applications is weird (some, for instance
ocamlbrowser, are very weird) but I can tolerate.

The following is an outline of installation steps (Mac OS 10.2.2 and higher
is expected):

0. Visit "www.tcl.tk" and get TclTkAqua_8.4.1-Jaguar.dmg, and install it.

After installation make four symbolic links as show followingly (you need to
be a super user):

/Library/Frameworks/Tcl.framework:

lr-xr-xr-x  1 root  staff   11 Jan  7 18:58 libtcl -> libtcl8.4.a
lr-xr-xr-x  1 root  staff   16 Jan  7 18:58 libtcl8.4.a -> Versions/8.4/Tcl   

/Library/Frameworks/Tk.framework:

lr-xr-xr-x  1 root  staff   10 Jan  7 18:58 libTk -> libTk8.4.a
lr-xr-xr-x  1 root  staff   15 Jan  7 18:58 libTk8.4.a -> Versions/8.4/Tk

1. Extract ocaml-3.06.tgz and apply the attached patch (tcltk4aqua.patch)

cd ocaml-3.06; patch -p1 tcltk4aqua.patch

2. Execute the configuration script

sh ocaml4darwin.conf

This script configures ocaml-3.06 for Mac OS X and for the Tcl/Tk just
installed.  It also builds "world, opt, and opt.opt".

 You might want to save the existing ocaml-3.06 installation.  In that case,
modify the script appropriately.

3. Install the ocaml-3.06 system

make install

4. Store makeapp.sh and Info.plist at the labltk's examples directory and
build clickable applications.

4.1 store makeapp.sh and Info.plist in "otherlibs/labltk/examples_labltk"
directory.

4.2 build examples

cd otherlibs/labltk/examples_labltk
make

4.3 build clickable applications

./makeapp hello
./makeapp tetris
...

4.4 locate the Finder application to the examples_labltk directory and start
the clickable applications.

Good luck

======================================================================
Old cwn
----------------------------------------------------------------------

If you happen to miss a cwn, you can send me a message
(alan.schmitt@inria.fr) and I'll mail it to you, or go take a look at
the archive (http://pauillac.inria.fr/~aschmitt/cwn/). If you also wish
to receive it every week by mail, just tell me so.

======================================================================

Alan Schmitt