* int v.s. long
@ 1996-03-25 5:00 Toshinao Ishii
1996-03-25 5:00 ` Dirk Grunwald
0 siblings, 1 reply; 2+ messages in thread
From: Toshinao Ishii @ 1996-03-25 5:00 UTC (permalink / raw)
Hi.
I've tried some simple benchmark about int and long on dUNIX 3.2C.
The source was just like what is attached in the last. It was just
a simple matrix multiplication of 'int' or 'long'. I want to know
whether calculation of 'long' is faster than that of 'int' on Alpha
which has 64bit architecture. (Of course, long is 8byte and int is
4byte.)
According to my result on our Alpha Server 2100, calculation with
'int' was about 10% faster than the calculation with 'long'.
My question is how this result should be evaluated. Well, ideally,
it is very happy if the calculation with 'long' is faster than that
with 'int'. However, in the long calculation, about twice of data
have to come and go between memory and registers. My guess is that
if the machine as well as cpu is well designed, the data transfer
is parallelized so that the machine can handle 8byte data as fast
as or faster than 4byte data.
Since I am not a computer architect, I cannot well explain the
bechmark result. I want to hear comments of the experts.
Thanks you in advance.
-=-=-=-=-=-=-=-=-=-=-=-=
Toshinao Ishii
Advanced Technology R&D Center
Mitsubishi Electric Corporation
email: ici@qua.crl.melco.co.jp (NeXTMAIL/MIME welcome)
#include <stdio.h>
#define TYPE long /* or int */
#define N 500
main(){
int i,j,k;
TYPE x;
TYPE a[N][N], b[N][N],c[N][N];
/* some initialization of a[][] and b[][] */
...
for(i=0; i<N; i++)
for(j=0; j<N; j++){
x = 0;
for(k=0; k<N; k++) x += a[i][k] * b[k][j];
c[i][j] = x;
}
printf("%d\n",c[N/2][N/2]);
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: int v.s. long
1996-03-25 5:00 int v.s. long Toshinao Ishii
@ 1996-03-25 5:00 ` Dirk Grunwald
0 siblings, 0 replies; 2+ messages in thread
From: Dirk Grunwald @ 1996-03-25 5:00 UTC (permalink / raw)
Accessing memory from cache is much faster than from bulk memory, and
the alpha is limited by the amount of bandwidth to and from memory.
The 4-byte items let you fit twice as much data in the on-chip cache.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1996-03-25 5:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1996-03-25 5:00 int v.s. long Toshinao Ishii
1996-03-25 5:00 ` Dirk Grunwald
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox