Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!hao!oddjob!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.lang.c Subject: Re: Printing binary Message-ID: <9110@mimsy.UUCP> Date: Mon, 26-Oct-87 19:34:25 EST Article-I.D.: mimsy.9110 Posted: Mon Oct 26 19:34:25 1987 Date-Received: Thu, 29-Oct-87 23:08:03 EST References: <35@ateng.UUCP> <3194@sol.ARPA> <2783@xanth.UUCP> <235@snark.UUCP> <1668@spar.SPAR.SLB.COM> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 21 In article <1668@spar.SPAR.SLB.COM> hunt@spar.SPAR.SLB.COM (Neil Hunt) writes, in response to a question about efficiency: >Check out all the stuff that has to happen to get the binary bits >displayed on the screen, or written to a file, and see if building >a new stack frame 31 times is a significant penalty. On a Vax 11/780, yes. putchar (of other than '\n') expands to 5 instructions n-1 out of n times, where n is the amount of buffering on a stdio stream; the loop and test expand to 3 more. A call-and-return on a 780 takes about 12 times longer than the `average' instruction. Hence if you are printing a very large number of binary numbers, the recursive routine will take more than twice as long user-time-wise. As another metric, the `average' 4.3BSD program uses a bit more user time than system time. Of course, you are probably printing very few binary numbers; and you are probably not using a machine with as heavy a call+return penalty as a 780. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7690) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris