Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!caen!hellgate.utah.edu!dog.ee.lbl.gov!nosc!manta!norton From: norton@manta.NOSC.MIL (LT Scott A. Norton, USN=) Newsgroups: comp.sys.amiga.advocacy Subject: Re: Peter, can you explain to the Amigoids (was: NeXT software size Summary: Smaller could be slower, but is often faster. Message-ID: <1970@manta.NOSC.MIL> Date: 9 May 91 03:16:08 GMT References: <*05Gx0x&1@cs.psu.edu> <11877@uwm.edu> Organization: Space & Naval Warfare Systems Command Lines: 44 Jon Bentley, in his book _Programming Pearls_, has a paragraph that adds some perspective to the Big Code thread here. If you're like several people I know, your first thought on reading the title of this column is "How old-fashoned!" In the bad old days of computing, so the story goes, programmers were constrained by small macines, but those days are long gone. The new philosophy is "a megabyte here, a megabyte there, pretty soon you're talking about real memory." And there is truth in that view -- many programmers use big machines and rarely have to worry about squeezing space from their programs. But every now and then, thinking hard about compact programs can be profitable. Sometimes the thought gives new insight that makes the program simpler. Reducing space often has desirable side-effects on run time: smaller programs are faster to load, and less data to manipulate usually means less time to manipulate it. Even with cheap memories, space can be critical. Many microprocessors have 64-kilobyte address spaces, and sloppy use of virtual memory on a large machine can lead to disterously slow thrashing. In the context of this discussion, certainly it takes longer to load 2MB of code than 512KB, but displaying animation frames can be done quicker if they are stored uncompressed in memory. I would dismiss the "size of Hello World" issue as irrelavant: code size there is strongly dependant on the up-front cost of operating system support. My world-record short Hello World program displays the message in 3-D rotating chrome letters, and its only 150 bytes long. It does use the hello.world.library though :^) Before I get flamed on this statement, think about the spectrum from OS ROM to loadable shared libraries to linked libraries to your own code. Also factor in the OS's overhead for buffers, Process Control Blocks, stack space, and other RAM costs. I recently got a new appreciation for the word "slow" -- my office computer at my new job is an original PC-XT, with a genuine full height, 10MB hard drive. It also gives me a perspective on small programs. ---- LT Scott A. Norton, USN JTIDS Ship Integration Officer