Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!umnd-cs!umn-cs!herndon From: herndon@umn-cs.UUCP (Robert Herndon) Newsgroups: comp.lang.c Subject: Re:Message-ID: <1711@umn-cs.UUCP> Date: Mon, 6-Jul-87 20:47:28 EDT Article-I.D.: umn-cs.1711 Posted: Mon Jul 6 20:47:28 1987 Date-Received: Wed, 8-Jul-87 01:39:15 EDT References: <8011@brl-adm.ARPA> Organization: University of Minnesota, Minneapolis Lines: 16 Summary: This makes a considerable difference! In article <8011@brl-adm.ARPA>, Alan_Cote.DlosLV-Comm@Xerox.COM writes: > >Henry Spencer suggests (assuming a and b have > >no side effects) > >>#define STREQ(a, b) (*(a) == *(b) && strcmp((a), (b)) == 0) > >>This makes a considerable speed difference in programs that use strings > >>a lot, since string comparisons usually fail on the very first character. This will also greatly slow a good many programs down on machines that do not support byte addressing. Unless there are good reasons to do this for a particular application, restraint should be used in applying this "optimization". Like many other optimizations, this is a pessimization for many machines. -- Robert Herndon Dept. of Computer Science, ...!ihnp4!umn-cs!herndon Univ. of Minnesota, herndon@umn-cs.ARPA 136 Lind Hall, 207 Church St. SE herndon.umn-cs@csnet-relay.ARPA Minneapolis, MN 55455