🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #1745

Re: Aggressive optimization

#1745
From: Dan Bernstein
Date: Thu, 18 Oct 1990 00:22
35 lines
1996 bytes
In article <1458@exodus.Eng.Sun.COM> chased@rbbb.Eng.Sun.COM (David Chase) writes:
> (AND, the optimizer will optimize for
> different machines, unlike the manual optimizer).

quickpick would remedy that, permanently.

> How often do you
> catch an optimizer bug, and often do you make a mistake
> hand-optimizing code?

First releases of optimizers simply don't work; after they've spent a
few years on the market, their bugs are few and far between. Maybe one
bug per ten thousand lines of code, after a year of maturity. It goes
down quickly past that.

I do not remember ever making a mistake in hand optimization by the most
fundamental standard technique: adding variable x to keep track of some
intermediate quantity, and eliminating redundant variables given x. What
optimizer can do this for any but the most primitive intermediate
expressions? (Introducing a pointer to traverse an array, and
eliminating the index that it replaces, is the simplest example.)

It would be interesting to see a language where you could say ``Okay,
keep 4*k + j - foo(i) in a register, and use it wherever possible.''
Somehow I don't think we have the technology yet.

  [ example of code: 30x faster from better algorithms, etc., in ]
  [ several weeks, 1.7x faster from optimizer in a couple of minutes ]

But I can usually get another 2x to 5x out of lots of ``picky'' hand
optimizations, having nothing to do with the algorithms. And I'm not
going to introduce subtle bugs in weird cases with unsafe program
transformations.

---Dan
Technical Details
Message-ID: <13405:Oct1800:22:5690@kramden.acf.nyu.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!yale!cmcl2!kramden.acf.nyu.edu!brnstnd
References: <65697@lanl.gov> <PCG.90Oct16160125@teachc.cs.aber.ac.uk> <1458@exodus.Eng.Sun.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!yale!cmcl2!kramden.acf.nyu.edu!brnstnd
From: brnstnd@kramden.acf.nyu.edu (Dan Bernstein)
Newsgroups: comp.lang.misc
Subject: Re: Aggressive optimization
Message-ID: <13405:Oct1800:22:5690@kramden.acf.nyu.edu>
Date: 18 Oct 90 00:22:56 GMT
References: <65697@lanl.gov> <PCG.90Oct16160125@teachc.cs.aber.ac.uk> <1458@exodus.Eng.Sun.COM>
Organization: IR
Lines: 35