This is the mail archive of the
libc-ports@sources.redhat.com
mailing list for the libc-ports project.
Re: [PATCH] Optimize MIPS memcpy
> Exactly what benchmarks did you run to verify the performance gains?
>
> The one thing I'd like to continue seeing is strong rationalization for
> performance patches such that we have reproducible data in the event that
> someone else comes along and wants to make a change.
>
> For example see:
> http://sourceware.org/glibc/wiki/benchmarking/results_2_17
>
> and:
> http://sourceware.org/glibc/wiki/benchmarking/benchmarks
>
> Cheers,
> Carlos.
We had a few tests around here that I used and I wrote one of my own
too. I have attached my test, when using it with -UVERIFY and testing
on a 74K system I got the following timings (32 bits, little-endian):
The FSF memcpy: 3m9.34s
Maxim's memcpy: 2m0.41s
My memcpy: 1m22.20s
If there are any official or recommended memcpy benchmarks I'd be happy
to try them as well.
Steve Ellcey
sellcey@mips.com
#include <string.h>
#include <stdio.h>
#define SIZE 1024*100
#define MAXCOPYSIZE 1024*50
#define MAXSRCOFFSET 13
#define MAXDSTOFFSET 18
#define SRCVAL(N) ((N+10000) % 13)
#define DSTVAL(N) ((N+20001) % 17)
char src[SIZE], dst[SIZE];
#ifndef MEMCPY_NAME
#define MEMCPY_NAME memcpy
#endif
extern void *MEMCPY_NAME(void *, const void *, size_t);
test(int src_offset, int dst_offset, int size)
{
int i;
char *x, *y;
for (i = 0; i < SIZE; i++) {
src[i] = SRCVAL(i);
dst[i] = DSTVAL(i);
}
x = src;
y = dst;
x = x + src_offset;
y = y + dst_offset;
MEMCPY_NAME(&dst[dst_offset], &src[src_offset], size);
for (i = 0; i < SIZE; i++) {
if (src[i] != SRCVAL(i)) printf("FAIL, src got changed\n");
if (i < dst_offset) {
if (dst[i] != DSTVAL(i))
printf("FAIL, dst got changed before it should be\n");
} else if (i >= (dst_offset+size)) {
if (dst[i] != DSTVAL(i))
printf("FAIL, dst got changed after it should be (%d %d %d %d)\n", src_offset, dst_offset, size, i);
} else {
if (dst[i] != SRCVAL(i-dst_offset+src_offset)) {
printf("FAIL, dst was not changed when it should be (%d %d %d %d)\n", src_offset, dst_offset, size, i);
}
}
}
}
main()
{
int i, j, k;
for (i = 8; i < MAXDSTOFFSET; i++)
for (j = 8; j < MAXSRCOFFSET; j++)
for (k = MAXCOPYSIZE-20; k < MAXCOPYSIZE; k++)
test(i, j, k);
}