From owner-freebsd-current Wed Aug 26 00:09:02 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id AAA18719 for freebsd-current-outgoing; Wed, 26 Aug 1998 00:09:02 -0700 (PDT) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from pcpsj.pfcs.com (harlan.fred.net [205.252.219.31]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id AAA18714 for ; Wed, 26 Aug 1998 00:08:58 -0700 (PDT) (envelope-from Harlan.Stenn@pfcs.com) Received: from mumps.pfcs.com [192.52.69.11] (HELO mumps.pfcs.com) by pcpsj.pfcs.com (8.8.8/8.8.8) via ESMTP id ; Wed, 26 Aug 1998 03:06:51 -0400 (EDT) Received: from brown.pfcs.com [192.52.69.44] (HELO brown.pfcs.com) by mumps.pfcs.com (8.8.8/8.8.8) via ESMTP id ; Wed, 26 Aug 1998 00:06:46 -0700 (PDT) Received: from localhost [127.0.0.1] (HELO brown.pfcs.com) by brown.pfcs.com (8.8.8/8.8.8) via ESMTP id ; Wed, 26 Aug 1998 03:06:44 -0400 (EDT) X-Mailer: exmh version 2.0.2 2/24/98 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 In-Reply-To: Joel Ray Holveck's (joelh@gnu.org) message dated Tue, 25 Aug 1998 17:54:26. <199808252254.RAA01679@detlev.UUCP> X-Face: "csXK}xnnsH\h_ce`T#|pM]tG,6Xu.{3Rb\]&XJgVyTS'w{E+|-(}n:c(Cc* $cbtusxDP6T)Hr'k&zrwq0.3&~bAI~YJco[r.mE+K|(q]F=ZNXug:s6tyOk{VTqARy0#axm6BWti9C d Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 26 Aug 1998 03:06:44 -0400 Message-ID: <25448.904115204@brown.pfcs.com> From: Harlan Stenn Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > > 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