[TUHS] On the uniqueness of DMR's C compiler
G. Branden Robinson
g.branden.robinson at gmail.com
Sat May 11 23:42:21 AEST 2024
At 2024-05-10T13:28:40-0400, Paul Winalski wrote:
> On Wed, May 8, 2024 at 2:29 PM Douglas McIlroy <
> douglas.mcilroy at dartmouth.edu> wrote:
> > Dennis was one-up on Digitek in having a self-maintaining compiler.
> > Thus, when he implemented an optimization, the source would grow,
> > but the compiler binary might even shrink thanks to
> > self-application.
>
> Another somewhat non-intuitive aspect of optimizing compilers is that
> simply adding optimizations can cause an increase in compilation speed
> by reducing the amount of IL in the program being compiled. Less IL
> due to optimization means less time spent in later phases of the
> compilation process.
This fact was rediscovered later when people found that some code
compiled with "-Os" (optimize for space) was faster than some code
optimized for speed ("-O1", "-O2", and so on).
The reason turned out to be that the reduced code size meant fewer cache
evictions, so you gained performance by skipping instances of
instruction fetches all the way from the slow main memory bus.
Think of all those poor unrolled loops...
Regards,
Branden
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://www.tuhs.org/pipermail/tuhs/attachments/20240511/d0356e94/attachment.sig>
More information about the TUHS
mailing list