Re: 32 bit integers

From: Scott Alexander (salex@research.bell-labs.com)
Date: Thu Oct 21 1999 - 21:17:41 MET DST


Date: Thu, 21 Oct 1999 15:17:41 -0400
From: Scott Alexander <salex@research.bell-labs.com>
To: "'caml-list@inria.fr'" <caml-list@inria.fr>
Subject: Re: 32 bit integers

Unfortunately, the Int32 library can have bad performance implications. When
we implemented SHA-1 (which pretty much assumes 32 bit ints), we originally
used Int32 because we wanted to have portability with either Alphas or
Pentiums. Unfortunately, the performance was unacceptable. For byte code,
using Int32, to SHA-1 4MB of data takes 86.4s on an Alpha whereas using (63
bit) ints on an Alpha takes only 36.0s. (Using native code, the numbers are
62.0s versus 2.5s.) Fortunately for us, we didn't care about the memory
overhead.

My guess was that much of this overhead is due to the fact that ints are
supported directly by the byte code interpreter rather than requiring a call
to a function. Similarly, I'm guessing that the native code compiler is
using the add instruction instead of arranging a function call.

In any case, while the Int32 package did give us some way of coping with
Pentiums, it wasn't a full solution.

Scott



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