Path: utzoo!attcan!uunet!lll-winken!lll-tis!ames!claris!apple!alan From: alan@Apple.COM (Alan Mimms) Newsgroups: comp.sys.mac.programmer Subject: Re: Knowing Machine Code Summary: Good fast optimizing compilers are HARD to build! Keywords: Compiler mc68k optimization gnu-cc sun apple lsc Message-ID: <12210@apple.Apple.COM> Date: 15 Jun 88 16:46:30 GMT References: <13735@comp.vuw.ac.nz> <104700032@uiucdcsp> <4760@husc6.harvard.edu> <13542@shemp.CS.UCLA.EDU> Reply-To: alan@apple.apple.com.UUCP (Alan Mimms) Organization: Apple Computer Inc, Cupertino, CA Lines: 62 I used to work for a company building an object-oriented programming environment based on Smalltalk-80, written ENTIRELY in C running on Apollo and Sun workstations. We got a copy of the (then very early beta-test) version of the GNU CC compiler and built it on our Sun 3/260 (24MHz 68020, I think) and recompiled our Smalltalk system using the resulting compiler. The results were ASTOUNDING! The system got almost 50% faster (than the version compiled with "-O" on the Sun compiler)! Also, it took quite a bit less time to compile the thing. This is with absolutely NO changes to the sources. Now, I don't want to start any flame wars concerning the Free Software Foundation and their compilers -- I personally applaud their commitment to quality software at no cost, but I know there are circumstances in which this has its problems. But the author of GCC does not hesitate to point out that his compiler is a memory HOG. Don't even try to run it on a machine without lots of virtual memory, he says... He's right. His compiler performs so well and is so powerful BECAUSE it uses lots of virtual memory for its very complete data structures, which have been designed to be efficient, but not at the cost of making the implementation of the optimizer difficult or complicated. He's trading off the human ability to handle complexity with the (at least at the time) ever-plummeting cost of computer memory. I believe that in the very near future, the industry will be able to return to the "memory is cheap" philosophy. Hopefully (governmental meddling willing), this time it will be permanent. The point I DO want to make is that efficient, optimizing compilers are VERY poorly understood beasties and that even large, well-funded companies don't necessarily do the job we know can be done. It frequently happens that a piece of complex software (e.g., an optimizing code generator for a compiler) must be written and there is NOONE available who has done one before! What is a software company to do, but to try educating the existing people and hope for the best? It is public knowledge that the MPW 2.0.2 C compiler was not written at Apple -- it is based on the GreenHills compiler, which (I THINK) is also being used on some other personal computers -- with a suitably modified code generator. Lightspeed C is a REMARKABLE product. It generates CORRECT and reasonably good code VERY VERY quickly and using (I believe, anyway) a fairly small memory. The advent of larger memory in most Macintoshes on a routine basis (which, as I said above, is likely to be soon) makes their choice not only reasonable, but economic. The memory manufacturers just haven't gotten their (considerably muddled) act together yet. When memory DOES get cheaper, and you can bet it will, THINK's choice will turn out to be an EXCELLENT one. Their product will again be the darling of the garage-shop software hacker. Give 'em a break. alan -- Alan Mimms My opinions are generally Communications Products Group pretty worthless, but Apple Computer they *are* my own... ...it's so simple that only a child can do it! -- Tom Lehrer, "New Math"