Path: 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 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