Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!convex!patrick From: patrick@convex.com (Patrick F. McGehearty) Newsgroups: comp.lang.misc Subject: Re: Compiler Costs Message-ID: <103726@convex.convex.com> Date: 6 Jul 90 17:52:22 GMT References: <1797@apctrc.UUCP> Sender: news@convex.com Organization: Convex Computer Corporation; Richardson, TX Lines: 35 In article <1797@apctrc.UUCP> zrra07@backus (Randall R. Appleton) writes: >I have a simple question: ... >In other words, if I take my average well written program, compiled >with a good optimizing compiler, and re-write it in assembler, what sort >of speedup should I expect to see? Since I have done this for a living before, I will provide my answer: Which is: "it all depends" (1) How much algorithm tuning have you already done (more gain is usually available here than any amount of assembly tuning) (2) How much code/language/machine tuning have you done? This step is frequently overlooked. Look at the output of the optiming compiler, revise the high level language by the use of declarations or temporaries or code rearrangement to generate better assembly. (3) How irregular is the architecture you are compiling for? i.e. it took a lot longer to have "good" optimizing compilers for the 8x86 line than it did for the 680x0 line. (4) How good is a "good" optimizing compiler? (5) How good are you at writing excellent assembly for the architecture in question? Do you know the details and quirks of the timings of the architecture? What about future generations of the same machine? It is more common than people realize to have assembly code which is much slower than the best high level language program as well as much harder to maintain and enhance in the future. Going to assembly too early makes it harder to radically revise an algorithm. In the best of cases, 0-4% gain might be obtained. For many combinations of compilers and assembly code writings 10-20% is available. For the real turkey compilers and really wizard tuners, >100% has been seen. So, I repeat, "it all depends"