Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site ucsbcsl.UUCP Path: utzoo!watmath!clyde!bonnie!akgua!sdcsvax!sdcrdcf!trwrb!trwrba!cepu!ucsbcsl!frew From: frew@ucsbcsl.UUCP (James Frew) Newsgroups: net.bugs.4bsd Subject: ul(1): simple speedups Message-ID: <255@ucsbcsl.UUCP> Date: Wed, 27-Mar-85 18:19:54 EST Article-I.D.: ucsbcsl.255 Posted: Wed Mar 27 18:19:54 1985 Date-Received: Sun, 31-Mar-85 03:01:52 EST Organization: U.C. Santa Barbara Lines: 36 Index: /usr/src/ucb/ul.c 4.2BSD Description: Ul's system time can be cut by about 80% by letting stdio decide what size buffer to use and when to flush it. Ul's user time can be cut by about 2/3 by calling bzero() instead of explicitly zeroing an array before each input line is processed. Repeat-By: Time "ul" on a large file before and after applying the following tweaks. Fix: The following diffs are easy to find, so to save space they are given without the "-c" context. 32,33d31 < char buf[BUFSIZ]; < 92d89 < setbuf(stdout, buf); 246d242 < fflush(stdout); 320,323c316,317 < for (i=0; i /* following depends on NORMAL == 000 */ > bzero(obuf, sizeof(obuf)); ----------------------------------------------------------------------- -- James Frew {arizona,cepu,sdcarl,ucbvax}!ucsbcsl!frew Computer Systems Lab., Univ. of Calif., Santa Barbara, CA 93106 (805) 961-2309