Xref: utzoo comp.arch:16977 comp.lang.misc:5107 Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!mcsun!ukc!cam-cl!news From: nmm@cl.cam.ac.uk (Nick Maclaren) Newsgroups: comp.arch,comp.lang.misc Subject: Re: Compiler Costs Message-ID: <1990Jul6.185248.12191@cl.cam.ac.uk> Date: 6 Jul 90 18:52:48 GMT References: <1797@apctrc.UUCP> Reply-To: nmm@cl.cam.ac.uk (Nick Maclaren) Organization: U of Cambridge Comp Lab, UK Lines: 29 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? > >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? It is impossible to predict, in general, but the following rules of thumb may be useful. Consider the minimal program to take unit time (or space); the following multiplicative factors are good guidelines: Competence of assembler programmer 1x - 5x Competence of 3 GL programmer 1x - 3x Suitability of 3 GL for algorithm 1x - 10x Competence of compiler's code 1x - 3x Degree of optimisation 1x - 10x You can therefore expect the assembler to be anything from 900 times faster to 5 times slower! This excludes even more drastic factors (in either direction), caused by gross mistakes or misunderstandings (e.g. dropping into a floating-point emulator to do 2-D array indexing). Nick Maclaren University of Cambridge Computer Laboratory nmm@cl.cam.ac.uk