Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site rlgvax.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!godot!harvard!seismo!rlgvax!guy From: guy@rlgvax.UUCP (Guy Harris) Newsgroups: net.lang.c Subject: Re: String copy idiom. Message-ID: <587@rlgvax.UUCP> Date: Thu, 21-Mar-85 00:53:16 EST Article-I.D.: rlgvax.587 Posted: Thu Mar 21 00:53:16 1985 Date-Received: Fri, 22-Mar-85 02:35:48 EST References: <7042@watdaisy.UUCP> <7044@watdaisy.UUCP> <7047@watdaisy.UUCP> <366@ccice6.UUCP> Distribution: net Organization: CCI Office Systems Group, Reston, VA Lines: 11 > Beware of saying things like "the fastest possible". > I found a better way for for any string longer than two characters. > The following is from 4.2BSD on a VAX. Geepers, didn't they teach you to use the "-O" option in school? Running your example through "cc" with the "-O" flag, I get the same code for both examples except that the second "FAST" version has an extra test at the beginning. "-O" does a fair bit of code motion, especially when strange sequences of jumps are involved; basically, it's covering PCC's tracks.