Goto Leads to Faster Code
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?
I like to see people replying to a post after reading the name subject line and then express an opinion that 1) Everyone knows and no one would argue with and 2) Has pretty much nothing to do with the article beside a easy pun.
I think you mean the summary. Anyone who read more than a few words into it would've realized they're talking about a person.
Point taken, but in the early days goto still made a lot of sense, but a lot of conventional, old practices have gone the wayside with compilers that are smarter and better optimizing, and with better standardization in languages overall.
The *first* time I learned C, goto was perfectly acceptible (yay K&R original C material).
But really, my point is that a computer doesn't see things in the sense of functions; it sees things in the sense of labels (memory addresses), and in a sense, programming using functions is simply another way of getting around labeling a routine.
"Victory means exit strategy, and it's important for the President to explain to us what the exit strategy is." G.W.Bush
The thing is, "Goto" isn't logical.
Your argument against Goto is even less logical. Goto is a conditional jump, where the condition is always true. It's an if (true) { do; }.
Our brains have plenty of Goto's hardcoded into them; "repeat" is typically implemented through in a "goto" fashion, but you'll want to ignore that if you're a modern computer. The correct way is to instead unroll the loop and have no jump instruction at all (if you can get around it).
Sigh. Why don't they teach assembly anymore. It should be a pre-req to learning higher level languages.
"Victory means exit strategy, and it's important for the President to explain to us what the exit strategy is." G.W.Bush
Considering the number of scientists who have been looking at this over a number of years, I think it really is a credit to Goto's work. Optimizing at this level is very challenging work on modern processors.
"Who is the Journal of Quantum Physics going to believe?" --Stephen Hawking
Obviously this prof was wrong. If he wanted you to code it in as few lines as possible, then he should have expected everyone's code to be completely unreadable, goto's or not. If he wanted your code to be understandable, then he should have asked to make the code as clear as possible, by using as many lines as you may need.
Anthropic principle: We see the universe the way it is because if it were different we would not be here to see it.
Which is certainly good, but to me says more about the previous implementation than it does about Goto's work.
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...)
We have given birth to a new acronym: RPFH Read Past the F**king Headline.
AT&ROFLMAO
Atlas is open-source and is a pretty good alternative. It is only a few percent slower than libgoto in most cases.
Save the bandwidth. Don't use sigs!
You do realise that GOTO command translated to a JMP isntruction, which any compiler produces in abundance anyway, right?
There is no performance issue at all. The ONLY reason 'goto' could be considered bad is that it becomes easy to write code that is difficult for humans to follow.
=Smidge=
Yuck! For this example, it'd be much clearer (to me), to simply initialize a function pointer to either foo or bar, and call that in a loop. I'd imagine it is just as fast. Jumping into loops can be clever, but is seriously non-intuitive, IMO.
"It's overkill, of course. But you can never have too much overkill." - Anonymous Slashdot Coward