From owner-freebsd-current Sat Sep 9 10:25:24 1995 Return-Path: current-owner Received: (from majordom@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id KAA20399 for current-outgoing; Sat, 9 Sep 1995 10:25:24 -0700 Received: from precipice.shockwave.com (precipice.shockwave.com [171.69.108.33]) by freefall.freebsd.org (8.6.12/8.6.6) with ESMTP id KAA20393 for ; Sat, 9 Sep 1995 10:25:22 -0700 Received: from localhost (localhost [127.0.0.1]) by precipice.shockwave.com (8.6.12/8.6.12) with SMTP id KAA00756; Sat, 9 Sep 1995 10:23:39 -0700 Message-Id: <199509091723.KAA00756@precipice.shockwave.com> To: Wolfram Schneider cc: current@FreeBSD.ORG Subject: Re: 20-40% faster wc(1) In-reply-to: Your message of "Sat, 09 Sep 1995 14:04:54 +0159." <199509091205.OAA18842@freebsd.first.gmd.de> Date: Sat, 09 Sep 1995 10:23:39 -0700 From: Paul Traina Sender: current-owner@FreeBSD.ORG Precedence: bulk I don't understand... the original isspace() was just a lookup in a table followed by an 'and'. I assume this changed because of the rune code? The question you should be asking yourself is WHY is isspace(3) slow? Not kludging wc. I do not think this patch should be accepted. Paul From: Wolfram Schneider Subject: 20-40% faster wc(1) --- 1.1 1995/09/09 11:30:35 +++ Makefile 1995/09/09 11:34:03 @@ -1,5 +1,6 @@ # @(#)Makefile 8.1 (Berkeley) 6/6/93 PROG= wc +CFLAGS+= -DOPT .include --- 1.1 1995/09/09 11:30:35 +++ wc.c 1995/09/09 11:33:01 @@ -122,6 +122,14 @@ struct stat sb; int fd; u_char buf[MAXBSIZE]; +#ifdef OPT + u_char spbuf[256]; /* buffer for isspace lookup */ + + for (ch = 0; ch < 256; ch++) + spbuf[ch] = isspace(ch); +#define ISSPACE(x) spbuf[x] +#endif + fd = STDIN_FILENO; linect = wordct = charct = 0; @@ -183,7 +191,11 @@ ch = *p++; if (ch == '\n') ++linect; - if (isspace(ch)) +#ifdef OPT + if (ISSPACE(ch)) +#else + if (isspace(ch)) +#endif gotsp = 1; else if (gotsp) { gotsp = 0;