Slashdot Log In
Goto Leads to Faster Code
Posted by
Hemos
on Mon Nov 28, 2005 10:00 AM
from the we're-punny-this-morning dept.
from the we're-punny-this-morning dept.
pdoubleya writes "There's an article over at the NY Times (registration required) about Kazushige Goto, the author of the Goto Basic Linear Algebra Subroutines (BLAS, see the wiki); his BLAS implementation is used by 4 of the current 11 fastest computers in the world. Goto is known for painstaking effort in hand-optimizing his routines; in one case, "when computer scientists at the University at Buffalo added Goto BLAS to their Pentium-based supercomputer, the calculating power of the system jumped from 1.5 trillion to 2 trillion mathematical operations per second out of a theoretical limit of 3 trillion." To quote Jack Dongarra, from the University of Tennessee, "I tell them that if they want the fastest they should still turn to Mr. Goto."" Ever get the feeling someone wrote an article merely for the pun?
This discussion has been archived.
No new comments can be posted.
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
This certainly is news to me. (Score:5, Funny)
Throwing bricks in glasshouses, anyone? (Score:5, Funny)
Ever get the feeling someone wrote an article merely for the pun?
Good thing the headline didn't contribute to that at all.
His code is more stable than Mr. Bluescreen's (Score:5, Funny)
I failed a coding test because of this guy (Score:5, Funny)
I had the shortest working code in the class but the arse hole teacher failed me for it. Said something like "we don't teach goto for a reason. Yeah, it's in the book, but don't ever use it!"
Jerk. I should post his phone number on slashdot
Re:I failed a coding test because of this guy (Score:5, Insightful)
Parent
GOTOs sometimes make the code *more* readable (Score:5, Interesting)
I like everyone else was trained *never* to use the dreaded goto statement. I'll grant that Pascal was more readable than Basic (with unlabeled gotos).
But, sometimes, it is actually better to use a goto to make the code more readable. The Linux Kernel, for example, uses gotos. I was pretty sceptical at first because it had been drilled into my head how unreadable code was with gotos in it. But, reading the code, I have to admitt is is much more readable for exception handeling, for example.
If the goto would not make your code more readable then don't use it. But, in the cases where it would avoid a bunch of sillyness trying to get out of a bunch of nested loops in case some error happened, then it makes a lot of sense.
Linus Torvalds (and others) explain the reasoning for this at:
http://kerneltrap.org/node/553 [kerneltrap.org]
In short, there are both readability and efficiency reasons to use gotos.
Parent
This was a test, aimed at slashdot readers... (Score:5, Funny)
Judging from the replies...not many people
Re:This was a test, aimed at slashdot readers... (Score:5, Funny)
The calls for the obligatory "You must be new here".
Parent
Re:This was a test, aimed at slashdot readers... (Score:5, Funny)
Wow. Slashdot article as Turing Test.
Parent
That would mean... (Score:5, Funny)
-Loyal
Computed goto (Score:5, Interesting)
Seriously. Computed goto is very useful for low-level
optimizations in things like high-throughput ethernet
drivers and such. It basically eliminates conditional
checks in cases where the condition stays the same
for a particular set of data. So instead ofone would haveIf the second part is executed in a loop, the savings of
not making an IF comparison accumulate fairly quickly.
Parent
DEC Math Library (Score:5, Interesting)
Add to that compilers that were producing top-notch machine language for the target architecture (producing images that ran twice as fast as what gcc gave you at best), CPUs that were spanking the rest of the world as far as floating-point performance was concerned, and you can understand why the scientific community has kept using Alphas for so long.
Where does the slashdot effect come from? (Score:5, Interesting)
I wonder where the slashdot effect comes from then?
Another punny name (Score:5, Funny)
"Robert A. van de Geijin, a computer scientist who works with Mr. Goto at the Texas Center,..."
All right, a Japanese programmer named Goto, working with a non-Japanese guy name Geijin. That's too much.
Well Done Slashdotters (Score:5, Insightful)
Libgoto is fast but not open-source (Score:5, Insightful)
Atlas [sourceforge.net] is open-source and is a pretty good alternative. It is only a few percent slower than libgoto in most cases.
Re:Libgoto is fast but not open-source (Score:5, Informative)
Parent
Re:So my professors were lying? (Score:5, Funny)
Parent
Re:goto is obsolete (Score:5, Funny)
I believe you are referring to Kazushige's cousin, Mr. Gosub.
Parent
Re:30%+ Improvement (Score:5, Insightful)
Parent
Re:30%+ Improvement (Score:5, Insightful)
Yeah, that previous implementation must have totally sucked. I know all my linear algebra software is written around an assembly language core, hand tuned for each new version of a half dozen processors, and designed from the start to minimize TLB misses instead of just naively trying to fit a dataset into L1 or L2 cache. I don't know why those retards at the universities and national labs were ever using anything else!
(closing Slashdot, going back to working on my shamefully unoptimized C++ numerics code...)
Parent
Re:30%+ Improvement (Score:5, Interesting)
Which only goes to show that you haven't considered the implications of optimization in modern processors. A Pentium 4 can operate above 3 GHz. This means that light can travel no more than 10 centimeters in the duration of one clock pulse. With the spacing in the motherboard, this isn't enough for a pulse to go from the CPU to the RAM and come back. Even if the memory could operate at the same rate as the CPU, the computation would still be limited by light speed alone.
Optimization to get the full advantage of a Pentium 4 doing floating point calculations is one of the most difficult tasks one can do in computing. A P4 can do, in one clock pulse, four multiplications and four additions. To get 100% of this speed one needs to have a sophisticated handling of cache memory, among other requirements.
Parent
Re:No you idiots - it's not about GOTO statements (Score:5, Funny)
Parent
Re:If true... (Score:5, Funny)
Parent
Re:If true... (Score:5, Funny)
If wife has headache, GOTO sleep
If boss is on vacation, GOTO strip bar for long lunch
If in-laws are coming over, GOTO work and pretend there is a critical problem that requires your presence all night
If technical conference is in Vegas, GOTO it
loads of examples.
If work is boring, GOTO slashdot to kill an hour or two
Parent