Xref: utzoo comp.arch:17014 comp.lang.misc:5123 Path: utzoo!attcan!uunet!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!rpi!batcomputer!cornell!uw-beaver!ubc-cs!calgary!ctycal!ingoldsb From: ingoldsb@ctycal.UUCP (Terry Ingoldsby) Newsgroups: comp.arch,comp.lang.misc Subject: Re: Compiler Costs Summary: Programmer time is worth something Message-ID: <460@ctycal.UUCP> Date: 9 Jul 90 18:37:20 GMT References: <1797@apctrc.UUCP> Organization: The City of Calgary, Ab Lines: 45 In article <1797@apctrc.UUCP>, zrra07@backus (Randall R. Appleton) writes: > I have a simple question: Does anyone know what sort of speed-up > on gets by going from a good implementation of some algorithm in a > third generation language (C, Fortran) and a good optimizing compiler > to hand-coded assembly? This seems to be following along in the thread of compiler optimization, where various people are suggesting that optimizers have or have not replaced human ingenuity in generating efficient code. This discussion loses sight of two things: 1) How hard (long) does the human try? - Some years ago I wrote some critical code for an application, part of which ran on a TMS32010 and part on an 8086 (it was a multi- processor system). There were two sections of the program that had to be *very* fast. I worked almost a week to write at most three pages of code. When I was done, I doubt that any optimizer could have beat that code. I tried the implications of using different registers for different purposes, and so on until I had what was the fastest possible implementation. But at what cost? I wrote about 150 assembler instructions in 5 days. That is 30 instructions/day, or 1 instruction every 15 minutes. 2) Does portability mean anything to you? - The code I wrote was very non-portable. If the processors had been changed, even to other members of the same family (eg. TMS32020 or 80286) then all my optimizations would have been for naught. The new processors would have required a different optimization strategy. The old code would have run, but not optimally. To me the argument of which is better is, man or machine, depends on what you are trying to accomplish. If time and money are not a problem, then an expert human can probably beat a compiler. If budgets or portability have any importance the compiler wins hands down. P.S. To answer your question, I probably saved 50% runtime on the tight portions of my code. -- Terry Ingoldsby ctycal!ingoldsb@calgary.UUCP Land Information Services or The City of Calgary ...{alberta,ubc-cs,utai}!calgary!ctycal!ingoldsb