Article View: comp.arch
Article #129Re: A challenge to the anti-goto Was: Re: Hardware Support for Numeric Algorithms
From: ADC system account
Date: Sun, 01 Nov 1992 10:07
Date: Sun, 01 Nov 1992 10:07
70 lines
3923 bytes
3923 bytes
In article <1cseutINNk30@fido.asd.sgi.com> shankar@sgi.com (Shankar Unni) writes: >Herman Rubin (hrubin@pop.stat.purdue.edu) wrote: >> I would like to see how you anti-gotos would write code of the following >> type so that either a human being could understand it ..... schematic code deleted >If anyone around here (read: "real world" (tm)) wrote code like that, >he or she would be fired pronto, and the code sent into the bit >bucket. >Dr. Rubin, this sort of code may be OK for one of your throwaway >research projects, but around these parts, people tend to move around >from job to job, and I pity the poor slob who had to maintain crap >like this. >Sometimes, giving up 5% of the cycles in order to get clean, readable >code with a reasonably clear flow of control is a perfectly acceptable >tradeoff. >If the loops get nested too deeply to be able to break out of neatly, >it is time to restructure the code (break it up, break off some code >into functions, etc.). >After all, next year, all the CPUs will be 25% faster, whereas the >code may have to be maintained, and worse, modified, for years and >years to come. ----------- I would not want to be in the position of defending Dr. Rubin's rather exotic theories on programming but the above is excessively provincial. Primus -- Not everyone in the world is a vendor of hardware or software; some people actually use computers to compute with. The "real world" of people writing commercial software for sale is not the whole real world of computing. Secundus -- Some algorithms are complicated. Rubin needs a fast implementation of an intriniscally messy algorithm. Babbling about clean, readable code [and breaking off code into functions!] is beside the point. Yes, production software for delivery wants to be clean and highly maintainable. Giving up 50% of the cycles [and 50% is a better rule of thumb than 5%] is well worth it, in general. But it is really a perversion of engineering practice to insist that guidelines that are appropriate in a particular domain are therefore universal for all domains -- of course, Rubin is guilty of the same thing. It is beside the point that tomorrows machines will be faster; Rubin needs all the speed he can get today. When tomorrow's machine comes along he will still need all the speed he can get. Now he has presented a task which he claims cannot be efficiently rewritten without gotos. He may be right -- case structures are usually less efficient than the equivalent goto formulations because of the checking and setup that is done. More generally, he is making the point that there are people who have to milk the machine for every last cycle, at least in critical code. Standard languages are not designed for such people. Nor should they be; the number of people who need that kind of optimization and can actually make use of it is small compared to the number of people who will make a mess of their code while trying to exploit optimization. -- Richard Harter: SMDS Inc. Net address: rh@smds.com Phone: 508-369-7398 US Mail: SMDS Inc., PO Box 555, Concord MA 01742. Fax: 508-369-8272 In the fields of Hell where the grass grows high Are the graves of dreams allowed to die.
Technical Details
Message-ID:
<1992Nov1.100719.11747@smds.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!sun-barr!ames!agate!usenet.ins.cwru.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!bu.edu!transfer!jjmhome!smds!adcsysReferences:
<BwxsF6.3DF@mentor.cc.purdue.edu> <1cseutINNk30@fido.asd.sgi.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!sun-barr!ames!agate!usenet.ins.cwru.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!bu.edu!transfer!jjmhome!smds!adcsys From: adcsys@smds.com (ADC system account) Newsgroups: comp.arch,comp.lang.misc Subject: Re: A challenge to the anti-goto Was: Re: Hardware Support for Numeric Algorithms Message-ID: <1992Nov1.100719.11747@smds.com> Date: 1 Nov 92 10:07:19 GMT References: <BwxsF6.3DF@mentor.cc.purdue.edu> <1cseutINNk30@fido.asd.sgi.com> Reply-To: rh@ishmael.UUCP (Richard Harter) Organization: Software Maintenance & Development Systems, Inc. Lines: 70