Date: Sun, 10 Sep 1995 14:20:15 +0200 From: Wolfram Schneider <wosch@cs.tu-berlin.de> To: Bruce Evans <bde@zeta.org.au> Cc: current@freebsd.org Subject: Re: 20-40% faster wc(1) Message-ID: <199509101220.OAA09230@caramba.cs.tu-berlin.de> In-Reply-To: <199509100758.RAA27567@godzilla.zeta.org.au> References: <199509100758.RAA27567@godzilla.zeta.org.au>
next in thread | previous in thread | raw e-mail | index | archive | help
Bruce Evans writes:
>#ifdef maybe
> /* It might be best to coalesce the space and newline tests. */
> myctype['\n'] |= 2;
>#endif
change:
if (ch == '\n')
++linect;
if (ISSPACE(ch))
gotsp = 1;
to:
if (ISSPACE(ch)) {
gotsp = 1;
if (ch == '\n')
++linect;
}
save ~20% user time :-))) [not a gcc bug, the algorithm was buggy]
Wolfram
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199509101220.OAA09230>
