🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #6688

Optimisation (Re: Common subexpression...)

#6688
From: Nick Rothwell
Date: Fri, 09 Feb 1990 16:36
52 lines
2960 bytes
In article <5453:23:28:32@stealth.acf.nyu.edu>, brnstnd@stealth writes:
>In article <2115@castle.ed.ac.uk> nick@lfcs.ed.ac.uk (Nick Rothwell) writes:
>> In article <838.18:06:33@stealth.acf.nyu.edu>, brnstnd@stealth writes:
>> >... If you care about ``information hiding''
>> >and the ``purity'' of your code more than efficiency, you can't expect
>> >fast code. If you can't bear to put your original code in comments and
>> >write an efficient version with temporary variables, you don't deserve
>> >fast code.
>> 
>> This is rubbish, check out the performance of New Jersey ML
>> (high-level functional language, efficient optimised native code
>> generation).
>
>Are you saying that your compiler is smarter than you are or just that
>it's not as lazy?

I think the original posting was relating essentially "global" or
structural optimisations of entire programs. However, I was really
taking exception to the blanket statement about "information hiding"
and "purity" being at odds with fast code.

>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?

No, it can't take a slow algorithm and turn it into a fast one. That
is still in the domain of the programmer. What a decent modern
compiler can do is support abstraction, information hiding, "purity"
of code (such as use of user-defined pure functions and arbitrary
local variables) and make it faster than I could do, since this kind
of optimisation (tail-recursion, eta/beta reduction and so on) is
complex and tedious but purely mechanical. I chose New Jersey ML as an
example because (i) ML is a very high level polymorphically typed
functional language, with the features you mentioned, and (ii) the
compiler generates excellent optimised code, on a par with the best C,
Pascal and the like.

>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.

Optimising algorithms, yes, agreed. Optimising the compilation/code
generation of programs, I don't think so.

>---Dan

		Nick.
--
Nick Rothwell,	Laboratory for Foundations of Computer Science, Edinburgh.
		nick@lfcs.ed.ac.uk    <Atlantic Ocean>!mcvax!ukc!lfcs!nick
~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~
		       ...als das Kind, Kind war...
Technical Details
Message-ID: <2190@castle.ed.ac.uk>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!samsung!uunet!mcsun!ukc!edcastle!lfcs!nick

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!samsung!uunet!mcsun!ukc!edcastle!lfcs!nick
From: nick@lfcs.ed.ac.uk (Nick Rothwell)
Newsgroups: comp.lang.misc
Subject: Optimisation (Re: Common subexpression...)
Message-ID: <2190@castle.ed.ac.uk>
Date: 9 Feb 90 16:36:26 GMT
Reply-To: nick@lfcs.ed.ac.uk (Nick Rothwell)
Organization: Waldorf Micro-Wave Tracking/Sighting/Authentication Subcommittee
Lines: 52
In-reply-to: brnstnd@stealth.acf.nyu.edu