Date: Sat, 9 Sep 1995 14:04:54 +0159 From: Wolfram Schneider <wosch@freebsd.first.gmd.de> To: current@freebsd.org, wosch@freebsd.first.gmd.de Subject: 20-40% faster wc(1) Message-ID: <199509091205.OAA18842@freebsd.first.gmd.de>
next in thread | raw e-mail | index | archive | help
--- 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 <bsd.prog.mk> --- 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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199509091205.OAA18842>