Xref: utzoo comp.lang.c:15768 comp.std.c:779 Path: utzoo!utgpu!attcan!uunet!lll-winken!ames!mailrus!husc6!cmcl2!phri!cooper!dasys1!ejablow From: ejablow@dasys1.UUCP (Eric Robert Jablow) Newsgroups: comp.lang.c,comp.std.c Subject: Re: BIT Counting: C programming problem Message-ID: <8398@dasys1.UUCP> Date: 23 Jan 89 07:43:52 GMT References: <225@tityus.UUCP> <35329@think.UUCP> Reply-To: ejablow@dasys1.UUCP (Eric Robert Jablow) Organization: Big Electric Cat//SUNY at Stony Brook Math Dept. Lines: 35 In article <35329@think.UUCP> barmar@kulla.think.com.UUCP (Barry Margolin) writes: >I haven't seen anyone so far suggest the far end of the time/space >trade-off: have a 64K table, with each element N containing the number >of bits in N (you'll probably have to use one of the slower mechanisms >to compute the contents of this table, but it only needs to be run >once when writing the program and then incorporated into the program >text as an initial value). [Remainder deleted.] >Barry Margolin >Thinking Machines Corp. >barmar@think.com >{uunet,harvard}!think!barmar "Why do you hoard?" "Why do you waste?" The Inferno, Dante That is a ridiculous idea. For microscopic savings in speed, you waste 63K of space. Were this program intended to be a standalone program, your suggestion might be accessible, but this program is obviously intended to be a part of some larger project. Certainly, the surrounding program will be much larger than the bitcount routine; what if it needs 400K to run effectively, or even 640K. An extra 64K will put most users over the edge. Besides, more and more people are going to multiprogramming environments, even on PCs, like Windows or DesqView. Then, it is vital to keep all programs as small as possible, so that the other programs have room to work. If you can assure me that the speed is the overriding condition, I might accept the 63K penalty. But I'd hate myself for it. -- Eric Jablow {allegra,philabs,cmcl2}!phri\ Big Electric Cat Public Unix {bellcore,cmcl2}!cucard!dasys1!ejablow New York, NY, USA New address: jessica!eric@sbee.sbcc.edu.