Re: Upgrade from OCaml 2.01 to OCaml 2.02 made things _slower_!

From: Xavier Leroy (
Date: Thu Mar 11 1999 - 10:44:42 MET

Date: Thu, 11 Mar 1999 10:44:42 +0100
From: Xavier Leroy <>
To: Alexey Nogin <>,
Subject: Re: Upgrade from OCaml 2.01 to OCaml 2.02 made things _slower_!
In-Reply-To: <36E73321.D37B49F6@CS.Cornell.EDU>; from Alexey Nogin on Wed, Mar 10, 1999 at 10:06:09PM -0500

> After I upgraded OCaml & Camlp4 from 2.01 to 2.02, our the native code
> of our program became much smaller (5124462 instead of 7219378), but it
> also became a little slower (1.5% - 3.5% for various inputs). Do you
> have an idea what could have caused it?

In the past, I've observed speed variations by at least +/- 5% caused
exclusively by minor variations in code placement (such as adding or
deleting instructions that are never executed). Almost any
modification in the code generator affects code placement. If only
for this reason, speed variations of less than 5% are essentially
meaningless: there's no way to attribute them to a particular
otpimization or to good/bad luck in code placement. (Makes you very
suspicious of those PLDI papers where they report 1% speedups...)

> Also, I was doing some performance mesurements (using P6 performance
> counter support patches for Linux by Erik Hendriks -
> ) when I upgraded, so I have some
> information (and can get more of it) on the performance counters for my
> program under both 2.01 and 2.02. In particular, the number of requests
> from the processor to the L1 data cache became 2%-3% bigger.

That's more meaningful. The two new optimizations in 2.02 (closed
toplevel functions and allocation coalescing) should reduce the number
of memory accesses. Allocation coalescing might increase register
pressure locally, causing other stuff to be spilled on the stack,
though. Is there any way you could get a per-function profile of
memory requests? (like on the Alpha with the Digital Unix tools).

- Xavier Leroy

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