From owner-freebsd-current Sun Sep 10 05:33:40 1995 Return-Path: current-owner Received: (from majordom@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id FAA20546 for current-outgoing; Sun, 10 Sep 1995 05:33:40 -0700 Received: from mail.cs.tu-berlin.de (mail.cs.tu-berlin.de [130.149.17.13]) by freefall.freebsd.org (8.6.12/8.6.6) with ESMTP id FAA20540 for ; Sun, 10 Sep 1995 05:33:32 -0700 Received: from caramba.cs.tu-berlin.de (wosch@caramba.cs.tu-berlin.de [130.149.144.4]) by mail.cs.tu-berlin.de (8.6.12/8.6.12) with ESMTP id OAA15507; Sun, 10 Sep 1995 14:20:25 +0200 From: Wolfram Schneider Received: (wosch@localhost) by caramba.cs.tu-berlin.de (8.6.12/8.6.9) id OAA09230; Sun, 10 Sep 1995 14:20:15 +0200 Date: Sun, 10 Sep 1995 14:20:15 +0200 Message-Id: <199509101220.OAA09230@caramba.cs.tu-berlin.de> To: Bruce Evans Cc: current@freebsd.org Subject: Re: 20-40% faster wc(1) In-Reply-To: <199509100758.RAA27567@godzilla.zeta.org.au> References: <199509100758.RAA27567@godzilla.zeta.org.au> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Sender: current-owner@freebsd.org Precedence: bulk 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