Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!mcsun!ukc!tcdcs!swift.cs.tcd.ie!vax1.tcd.ie!rwallace From: rwallace@vax1.tcd.ie Newsgroups: comp.arch Subject: Re: Compiler Costs Message-ID: <6534.26a0d62b@vax1.tcd.ie> Date: 15 Jul 90 20:46:35 GMT References: <40052@mips.mips.COM> <628@dg.dg.com> <64045@sgi.sgi.com> Organization: Computer Laboratory, Trinity College Dublin Lines: 36 In article <64045@sgi.sgi.com>, karsh@trifolium.esd.sgi.com (Bruce Karsh) writes: > In article <628@dg.dg.com> publius@dg-pag.webo.dg.com (Publius) writes: > >>Many "large" programs spend most of the CPU time in one or a few relatively >>"tiny" routines. > > This is an often stated. Is there any evidence for this? What does the > distribution of time look like for, for instance, a compiler? I'd expect > that there would be lots of time-sinks. The lexical analyzer, the symbol table > hash routine, the symbol table lookup routine, common subexpression finder, > ... etc, could all be candidate time-sinks. > > How about a text editor? I could think of a few dozen potential time-sinks > in a text editor. > > When I've profiled programs, I've often found that the time is spent mostly > in a few routines, but this isn't always the case. How often is it true that > nearly all of the time is spent in only a few routines? How often are these routines tiny? > Usually this is the case. The compiler is an exception because it's an all-round integer CPU intensive program, but I disagree with you on the text editor. I was writing a simple text editing facility on an accounting package in Turbo C on an MS-DOS machine a couple of weeks ago. The editor ended up spending almost all its time either paging or scrolling. Paging partly involves setting memory to a particular value, which ended up as a 3-line loop of C coded, so those 3 lines of code were taking about 30%-40% of the total execution time. Now the 80x86 is a pretty foul processor for memory writes and copies but by examining the assembly language output and changing 2 lines of C code I enabled the compiler to double the speed of the code for that inner loop. Lo: a 20% speed improvement by changing 2 lines. Russell Wallace, Trinity College, Dublin rwallace@vax1.tcd.ie "To summarize the summary of the summary: people are a problem"