🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #6680

Re: Common subexpression optimization

#6680
From: Jim Giles
Date: Thu, 08 Feb 1990 23:47
28 lines
1574 bytes
From article <5453:23:28:32@stealth.acf.nyu.edu>, by brnstnd@stealth.acf.nyu.edu:
> [... Good ML compiler ...] 
> Can it figure out, say, Knuth's algorithm for computing the delta2 table
> in Boyer-Moore string searching, starting from a dumb algorithm for the
> same job?
> 
> Humans can optimize better than computers. This will be true for a long
> time. I chose the above example randomly, but it'll serve well enough as
> a goal that I won't live to see computers reach.


Good example.  It demonstrates the point I've been making all along!
Ther are optimizations that the compiler can't yet do well.  There _may_
be optimizations that compilers will _never_ be able to do.  It is these
types of things that programmers should spend their effort on.

However, your example does NOT support your claim that programmers should
do strength-reduction or array indexing by hand.  These are things that
compilers of today CAN do reasonably well.  They are also things which
decrease the clarity of the code.

All your example shows is that good choice of algorithm is worth more
than penny-pinching optimizations.  This old platitude is the commonplace
of programming.  So, what have you said that's new?

J. Giles
> 
> ---Dan
Technical Details
Message-ID: <14235@lambda.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!yale!cmcl2!lanl!lambda!jlg
References: <5453:23:28:32@stealth.acf.nyu.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!yale!cmcl2!lanl!lambda!jlg
From: jlg@lambda.UUCP (Jim Giles)
Newsgroups: comp.lang.misc
Subject: Re: Common subexpression optimization
Message-ID: <14235@lambda.UUCP>
Date: 8 Feb 90 23:47:55 GMT
References: <5453:23:28:32@stealth.acf.nyu.edu>
Lines: 28