Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site ucbvax.ARPA Path: utzoo!watmath!clyde!burl!ulysses!ucbvax!hamachi@ucbkim From: hamachi@ucbkim Newsgroups: net.micro.mac Subject: C Compilers: A Comparison Message-ID: <5056@ucbvax.ARPA> Date: Mon, 25-Feb-85 01:59:23 EST Article-I.D.: ucbvax.5056 Posted: Mon Feb 25 01:59:23 1985 Date-Received: Wed, 27-Feb-85 07:07:29 EST Sender: daemon@ucbvax.ARPA Organization: University of California at Berkeley Lines: 101 From: hamachi@ucbkim (Gordon Hamachi) Attention would-be compiler buyers. Here are the results from my informal survey of C compilers for the Macintosh. At the Macworld Expo this weekend I went from booth to booth, running the same benchmark through each vendor's compiler. The benchmark was the sieve program as published in Byte magazine, August 1983. The benchmark did not use register variables. The "Size" entry in the table refers the the size in bytes of the a.out resulting from compiling the sieve program. The "Small" entry shows the size of the a.out for the trivial program main(){printf("Hello, world.\n");}. This gives a measure of the incremental size of the code produced by the compiler. Vendor Memory Disk Compile Link Load+Run Run Size Small =========================================================================== Megamax 512K Floppy 7.9 71 13.0 6.6 5484 5276 Megamax 512K Corvus Omni 2.7 23 9.2 6.6 5484 5276 Softworks 128K Floppy 77.4 111.9 15.8 8.8 34560 26368 Consulair 512K HyperDrive 19.2 14.5 15.2 8.0 10496 10240 Hippo 2 512K Ram Disk 11.6 8.8 14.1 --- 13864 --- Note that no two vendors had the same hardware configuration. It is hard to make comparisons because of these hardware differences. I assume that a RAM disk is faster than the HyperDrive, which is faster than the Corvus Omni, which is faster than the floppy. How much faster? I've written to the companies to see if they will send me software for further analysis. Run times were measured with the stopwatch on my digital wrist watch. I'd like to redo this using the tickcount() function from the Mac toolbox. Manx Aztec C was not in attendance. Too bad. Megamax looks pretty good in every category except linking time. It compiles like the proverbial bat out of hell. I don't see linking time as a problem as you win big in the size of the resulting a.out file. Theirs is the only linker that throws out routines it doesn't need. If only you could selectively turn that optimization on and off. Softworks uses the Apple (Consulair) linker. I forget, maybe Hippo does too. They go directly from source to object, with no intermediate assembly step. It is fast, but you can't look at asm code except by disassembling. On the other hand, I found a couple of bugs in the Megamax compiler. Remember when you read this that I spent more time with this compiler than any of the others, so don't jump to any conclusions. The Softworks compiler seemed a bit more complicated to use. It has built-in optimization that you can't turn off. On the other hand, unlike the Megamax compiler, you can look at an intermediate assembly language file and even munge around with it. Some quirks of Softworks: You MUST have at least one global variable, and that global variable must be initialized at compile time. Every line must be terminated by a carriage return. It is a compiler error if the last line ends in a '}'. My impression is one of killing a gnat with an atom bomb. It is a port of the Whitesmith C compiler. Does this mean that it is a "real" compiler, capable of gracefully handling mammoth programs? Consulair has the most Mac-like user interface. It seemed slick and the easiest to use. Better performance may be on the way--code optimization and floating point are planned for mid April. Originally this release was planned to be much earlier. Bill DuVall's wife said that Bill has been tied up putting the finishing touches on the Apple MDS package. Their booth seemed to get a LOT of attention. It was hardest to get near this booth, let alone run a benchmark. Hippo had a unix-like interface. The prompt was even a percent sign. Many of the expected commands like "ls" and "rm" were there. You compile by typing "cc" followed by command line arguments. You exit to the finder by typing "logout". There's a certain appeal to this kind of environment. I'd like to use it for a few days and then decide which is better. Let's face it, the easiest to use systems make you select a file from a scrolling dialog box, but if the file you want isn't visible in the window, it is clumsy and annoying to scroll the window in search of the file. All the vendors were helpful and friendly. The folks at Softworks and at Hippo seemed more distracted (burned-out?) than the others. Consulair and Megamax seemed the most lively and helpful with my evaluation project. Not to leave anyone out, I talked to a guy who swears by the Aztec C compiler from Manx. Please use these numbers for comparison only. Your mileage will differ, and may be less. Some weaknesses with my evaluation: Non-uniform hardware. Only one small program, no "real sized" ones. Timing was a bit sloppy, and tended to include the time to load a program. Thus, compilers generating big a.out files tend to run slower by my way of measuring. My best advice is to try as many of these compilers as possible and draw your own conclusions. Or, hope that all vendors send me evaluation copies, and watch this space for future announcements. If anyone knows of a Macintosh C compiler I've left out, please tell me their name and address. --Gordon Hamachi