www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/02/04/02:50:15

Message-Id: <3.0.6.32.19990204024816.008d9720@pop.netaddress.com>
X-Sender: pderbysh AT pop DOT netaddress DOT com
X-Mailer: QUALCOMM Windows Eudora Light Version 3.0.6 (32)
Date: Thu, 04 Feb 1999 02:48:16 -0500
To: djgpp AT delorie DOT com
From: Paul Derbyshire <pderbysh AT usa DOT net>
Subject: Re: Question about long long math on intel archs
In-Reply-To: <36B8BE0E.75F9F83C@cartsys.com>
References: <3 DOT 0 DOT 6 DOT 32 DOT 19990202153421 DOT 0091a590 AT pop DOT netaddress DOT com>
<3 DOT 0 DOT 6 DOT 32 DOT 19990202173547 DOT 00915bb0 AT pop DOT netaddress DOT com>
<3 DOT 0 DOT 6 DOT 32 DOT 19990202223415 DOT 0094bda0 AT pop DOT netaddress DOT com>
Mime-Version: 1.0
Reply-To: djgpp AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019