Date: Wed, 26 Aug 1998 03:06:44 -0400 From: Harlan Stenn <Harlan.Stenn@pfcs.com> To: joelh@gnu.org Cc: garbanzo@hooked.net, mike@smith.net.au, entropy@compufit.at, wwoods@cybcon.com, freebsd-current@FreeBSD.ORG Subject: Re: gcc 2.8 Message-ID: <25448.904115204@brown.pfcs.com> In-Reply-To: Joel Ray Holveck's (joelh@gnu.org) message dated Tue, 25 Aug 1998 17:54:26. <199808252254.RAA01679@detlev.UUCP>
next in thread | previous in thread | raw e-mail | index | archive | help
> > I tested two packages. > > One compares a number (6-8) byte move subroutines (memcpy, bcopy, a variety > > of Duff's devices (using char, short, and int), and some other "fast" byte > > copies I've snarfed over the years). > > Just to be sure: these are using their own recompiled bcopy etc, and > not running the ones out of libc? This benchmark uses whatever libc byte movers are detected (bcopy or memcpy), and 5 or 6 different "source" versions. > > I run a reasonable quantity of different size/alignments against each of > > these, and report the CPU time of each one. > > Could you please post this data? It's kinda boring, but if everybody is interested I'll post it. If only a couple of folks are interested, I'll send it directly. Basically, I added the following code to the byte-mover subroutine: #ifdef BMOVESTATS #define BMS_MAXSIZE 2049 int bms[BMS_MAXSIZE + 1][4][4]; #endif /* BMOVESTATS */ (I picked 2049 because this application hardly ever moves bigger chunks of memory.) ... and inside the byte mover subroutine: #ifdef BMOVESTATS if((n = len) > BMS_MAXSIZE) { n = BMS_MAXSIZE;} ++bms[n][((int)src) & 3][((int)dst) & 3]; #endif /* BMOVESTATS */ ... and I call this subroutine before the executable exits: void bmovestats(void) { #ifdef BMOVESTATS int i; int d; int s; FILE *fp; #define BMOVE_STATFILE "bmovestats" if((fp = fopen(BMOVE_STATFILE, "w")) == NULL) { fp = stderr;} for(i = 0; i <= BMS_MAXSIZE; ++i) for (s = 0; s < 4; s++) for (d = 0; d < 4; d++) if(bms[i][s][d]) fprintf(fp, "%d\t%d\t%d\t%d\n", i, s, d, bms[i][s][d]); if(fp != stderr) { fclose(fp);} #endif /* BMOVESTATS */ return;} Then I ran several applications under various production conditions, collected various "bmovestats" files, and then ran a little program that, for each byte mover, basically ran the following loop (in this case, for bcopy): #ifdef HAVE_BCOPY rewind(ifp); (void)times(&t_b); t_u = t_b.tms_utime; while((rc = fscanf(ifp, "%d%d%d%d", &len, &sa, &da, &qty)) != EOF) { sp = src + sa; dp = dst + da; for(i = 0; i < qty; i++) { bcopy(sp, dp, len);}} (void)times(&t_b); printf("%8.0d", t_b.tms_utime - t_u - ovhd); fflush(stdout); #endif /* HAVE_BCOPY */ the "ovhd" value is the time to run the loop with *no* byte copy being performed; I suspect a Really Good Compiler would pretty much invalidate this benchmark. "ifp" points to the current "bmovestats" file. H To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?25448.904115204>