Mail Archives: djgpp/1999/02/04/02:50:15
At 01:22 PM 2/3/99 -0800, you wrote:
>So perhaps you could write the benchmarks, and put them somewhere that
>others with such machines can run them. I have a 300MHz K6-2 that I'd
>put through its paces.
Okay... here it is. On my P166 it does 50 million long long multiplies in
20 seconds. This compiles and works using
gcc int64.cc -o int64.exe -wall -liostr
// int64.cc
// long long benchmark (c) 1999 PGD, freely distributable
#define TICKS_PER_SEC 18.2
#include <time.h>
#include <iostream.h>
static void benchmark (unsigned int num) {
// Perform num long long multiplies and measure time.
unsigned int starttm=rawclock();
unsigned int endtm;
long long foo=12345679;
long long bar=987654321;
for (int i=num; i; --i) {
foo = foo*bar;
++bar;
}
// The numbers are changed to simulate lots of multiplies of widely
varying data.
endtm=rawclock();
if (endtm<starttm) {
// Must have passed midnight
endtm=endtm+static_cast<unsigned int>(TICKS_PER_SEC*60.0*60.0*24.0);
}
cout << "Did " << num << " long long multiplies in " <<
(static_cast<double>(endtm-starttm))/TICKS_PER_SEC << " seconds." << endl;
}
int main (void) {
benchmark(1000000);
benchmark(5000000);
benchmark(10000000);
benchmark(50000000);
return 0;
}
--
.*. "Clouds are not spheres, mountains are not cones, coastlines are not
-() < circles, and bark is not smooth, nor does lightning travel in a
`*' straight line." -------------------------------------------------
-- B. Mandelbrot |http://surf.to/pgd.net
_____________________ ____|________ Paul Derbyshire pderbysh AT usa DOT net
Programmer & Humanist|ICQ: 10423848|
- Raw text -