Path: utzoo!utgpu!attcan!uunet!husc6!spdcc!ima!compilers-sender From: roy@phri.uucp (Roy Smith) Newsgroups: comp.compilers Subject: Optimization tradeoffs (time vs. space) Message-ID: <1853@ima.ISC.COM> Date: 1 Aug 88 18:01:03 GMT Sender: compilers-sender@ima.ISC.COM Reply-To: roy@phri.uucp (Roy Smith) Organization: Public Health Research Institute, NYC, NY Lines: 29 Approved: compilers@ima.UUCP Some compilers have options to select what kind of optimization to do: space or time. Can somebody give me some idea of how much difference it makes which you pick? Lots of optimizations (most?) reduce both object code size and execution time. For example, in the fragment: X = Y X = Z it's obvious that removing the code generated from the first statement will do both. To my naive mind, it seems that the difference between the two types of optimization would be rather small. -- Roy Smith, System Administrator Public Health Research Institute {allegra,philabs,cmcl2,rutgers}!phri!roy -or- phri!roy@uunet.uu.net "The connector is the network" [In my experience, except in contrived programs the difference is usually insignificant. The one exception that leaps to mind is situations like a C switch statement that involves looking something up in a sparse table. The fastest code would subscript a huge array, while the smallest would probably do a hear or linear search. The paging overhead associated with the huge array often negates any speed advantage, but compiler writers usually figure that's somebody else's problem. -John] -- Send compilers articles to ima!compilers or, in a pinch, to Levine@YALE.EDU Plausible paths are { ihnp4 | decvax | cbosgd | harvard | yale | bbn}!ima Please send responses to the originator of the message -- I cannot forward mail accidentally sent back to compilers. Meta-mail to ima!compilers-request