division within a loop
Chuan Chee
ckchee at dgp.toronto.edu
Mon Feb 1 19:38:08 AEST 2016
I am running on a IRIS 4D/20 (Release 4D1-3.14711181642).
It seems that if I have a division as the only operation within a loop,
it is EXTREMELY SLOW! The following shows data that I collected and
the program I used to test the operations. I even looked at the assembler
output to see that it is doing what was intended. No one else was
on the system.
-----
main()
{
int i;
double a = 1e+10;
for( i = 0; i < 100000; i++ ){
a /= 1.1; /* operation goes on this line */
}
}
------
On a IRIS 4D/20
cc -O2 timing.c -lm
time a.out
100,000 divisions "a /= 1.1;"
104.5u 0.5s 1:45.06 100%
104.5u 0.1s 1:44.68 100%
104.4u 0.4s 1:44.87 100%
104.4u 0.5s 1:45.00 100%
100,000 multiplications "a *= 1.1;"
0.3u 0.1s 0:00.50 100%
0.3u 0.1s 0:00.56 100%
100,000 additions "a += 1.1;"
0.2u 0.1s 0:00.37 100%
0.1u 0.1s 0:00.37 100%
100,000 divisions and additions in same loop "a /= 1.1; a += 1.1;"
1.0u 0.2s 0:01.31 100%
1.0u 0.2s 0:01.31 100%
100,000 divisions and additions in separate loops within same program
111.5u 0.5s 1:52.00 100%
111.4u 0.4s 1:51.87 100%
100,000 two consecutive divisions "a /= 1.1; a /= 1.1;"
220.0u 0.6s 3:40.75 100%
220.4u 0.6s 3:41.06 100%
100,000 sqrt() "a = sqrt(1.1);"
7.3u 0.1s 0:07.56 100%
7.4u 0.1s 0:07.56 100%
7.4u 0.1s 0:07.56 100%
100,000 exp() "a = exp(1.1);"
6.0u 0.2s 0:06.31 100%
6.0u 0.1s 0:06.25 100%
-----
By the way, the Iris-4D/20 is not the only computer that does this.
A SUN-3/280 with fpa (compile option) also exhibits this symptom.
BUT, strangely enought, the SAME SUN-3/280 with 68881 compile option
does not! Neither does a SUN-3/60 with 68881.
Is there something wrong with these coprocessors?
...Chuan Chee
ckchee at dgp.utoronto.ca (cdnnet)
ckchee at dgp.toronto.edu (internet)
ckchee at dgp.utoronto (bitnet)
More information about the Comp.sys.sgi
mailing list