English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
32 bit integers
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 1999-10-25 (15:29)
From: Scott Alexander <salex@r...>
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

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.