This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v3] Don't spin around multiplying zeroes in __mul
On Wed, Jan 16, 2013 at 07:18:20AM -0600, Ryan S. Arnold wrote:
> Siddhesh, What are you running to gather your performance numbers? I'd
> like to do a comparison on Power.
>
I'm using the program below, which is modified from:
http://entropymine.com/imageworsener/slowpow/
The method of getting the numbers is the same as the benchmark suite
patch I had posted, i.e. using CLOCK_MONOTONIC_RAW around the function
call over multiple calls and getting the average, so it should get the
same results.
The input I use is:
./powtest 100000 1.0000000000000020 1.5000000000000000
which for x86_64 hits the slowest computation path, which uses a
precision of 32 mantissa digits in mp_no, i.e. 768bits. For Power,
you might want to make sure that it escapes the ldbl code and actually
enters the mp code; I think it does, but I don't remember right now.
Siddhesh
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <stdint.h>
struct timespec start, end;
int main(int argc,char**argv)
{
int i;
volatile double b, e, x;
uint64_t total = 0, max = 0, min = 0x7fffffffffffffff, count;
double avg;
if (argc<4) { printf("error\n"); return 1; }
count = atoi(argv[1]);
b = atof(argv[2]);
e = atof(argv[3]);
for (i=0;i<count;i++) {
clock_gettime(CLOCK_REALTIME, &start);
x = pow(b,e);
clock_gettime(CLOCK_REALTIME, &end);
uint64_t diff = end.tv_nsec - start.tv_nsec + 1000000000 * (end.tv_sec - start.tv_sec);
if (diff > max)
max = diff;
if (diff < min)
min = diff;
total += diff;
}
printf("(count=%d) %.16f^%.16f = %.16f\n",count,b,e,x);
printf ("Total:%lld, Fastest:%lld, Slowest:%lld, Avg:%lf\n",
total, min, max, (double) total / count);
return 0;
}