Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site hropus.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxt!houxm!hropus!ka From: ka@hropus.UUCP (Kenneth Almquist) Newsgroups: net.lang.c Subject: Re: Re: fast code and no morals Message-ID: <231@hropus.UUCP> Date: Tue, 28-Jan-86 02:25:15 EST Article-I.D.: hropus.231 Posted: Tue Jan 28 02:25:15 1986 Date-Received: Wed, 29-Jan-86 04:23:52 EST References: <842@megaron.UUCP> <1820@brl-tgr.ARPA> <68@valid.UUCP> Organization: Bell Labs, Holmdel, NJ Lines: 25 >>> Here's a version of calloc that breaks every rule of "structured" >>> programming ever invented -- and runs about twice as fast as a >>> vanilla version: >> >> So what? This can be written "structured", and would be more >> maintainable if it were. Surely this is not an example of >> recommended practice? > > Sure is recommended if you are optimizing for speed, which is what I assume > is being done here. Since calloc is part of the system, and is assumed to > not have to be changed, maintainability is not the question. Speed is the > answer. "Assumed to not have to be changed!!!???" I shouldn't even have to mention the machine dependencies in this code or the coming of "void *"; I can assure you that any code that is used must be maintained. As for the importance of speed, I have learnt the hard way to think about what the code is supposed to do before I start hacking at it. The System V Release 2 calloc is not only clear and short (three lines of C code), it is no doubt *faster* than the posted calloc to boot. Kenneth Almquist ihnp4!houxm!hropus!ka (official name) ihnp4!opus!ka (shorter path)