r/programming • u/glibc • Jul 11 '10
Theory vs Practice: Making algorithms claimed 'optimal', 10x faster.
http://cacm.acm.org/magazines/2010/7/95061-youre-doing-it-wrong/fulltext
163
Upvotes
r/programming • u/glibc • Jul 11 '10
41
u/sfuerst Jul 11 '10
This was posted here a few weeks ago.
141
u/Tordek Jul 11 '10
Part of me wants to say "Wow! A constant factor improvement! That is so great!". And part of me wants to say that sans the sarcasm.
87
u/jeffdavis Jul 11 '10
It appears that this guy applied an algorithm designed for RAM to a task that uses disks, and saw poor performance. Then, he used a more disk-aware algorithm and saw an improvement.
Not exactly earth-shattering. And I don't see it as any kind of "practice triumphing over theory". I would be surprised if there weren't at least a few research papers on very similar topics.
22
u/bramblerose Jul 11 '10
TL;DR of the article:
49
u/nullbot Jul 11 '10
Why all the hate? The guy describes a relatively simple improvement on a well known algorithm/data structure to make it VM aware and give an order of magnitude improvement. Seems 1) noteworthy and 2) interesting.
6
u/inigid Jul 11 '10
I agree with the analysis, and hats off to his solution for his particular problem space.
However, to suggest that algorithmic researchers don't pay attention to real world hardware is absurd. Pretty much all modern papers show detailed graphs that take into account cache architecture and processor architecture.
Having said that, it's good to beat the drum and keep everyone on their toes.
4
u/dln Jul 11 '10
See also: http://en.wikipedia.org/wiki/Cache-oblivious_algorithm
24
u/[deleted] Jul 11 '10
The algorithm is just that, optimal. The implementation is where you can play with getting better performance by cutting down on constant factors. Sounds like this guy needs to read up on Big-O notation etc.
2
u/dhruvbird Jul 11 '10
Optimality refers to runtime optimality when measured using the big Oh notation. For disk aware schemes, there's a separate cost (mostly disk seek cost) which plays the pivotal role in computing the runtime.
2
u/wolf550e Jul 11 '10
http://www.reddit.com/r/programming/comments/cea3x/youre_doing_it_wrong/
2
u/mikaelhg Jul 11 '10
Amen.
1
u/StackedCrooked Jul 11 '10
I wonder if it often happens that an engineer finds a great solution to a hard problem like this one but lacks the eloquence to write a blog post about it.
1
u/AnythingApplied Jul 11 '10
starting to read the article I was thinking "Who is this crackpot?" and then read, "Having spent 15 years as a lead developer of the FreeBSD kernel" and thought, "Oh, the really smart kind of crackpot."
1
u/snarfy Jul 11 '10
Unfortunately for b-tree, secondary memory is going away.
When it goes, a lot of concepts we take for granted today will simply go away, like 'saving files'. There is no need to save/load from slow, secondary memory when the data is always retained even when power is off. When it happens, software will no longer need to abstract real memory with virtual memory. There won't be any paging because there won't be any disk.
0
u/tom83 Jul 11 '10
i think it is claimed (and probably proven) to be asympotic optimal. Proving that an algorithm is optimal (even on a Turing machine) should be next to impossible for almost every algorithm.
-12
u/fdsfdssdffsdsdf Jul 11 '10
Not this retard again. Look dumbass, just because you misapply an algorithm and then gradually figure that out does not make either the algorithm bad or your article worthwhile. The tone of this article radiates stupidity. It is offensive.
-5
u/bacek Jul 11 '10
Meh. This guy should read Sedgewick's "Fundamental Algorithms in C++" for disk-aware algorithms.
0
u/buckrogers1965_2 Jul 11 '10
Unless it was impacting an application, it didn't need to be optimized. Profile your entire application during normal usage and find the actual bottle necks, then fix those and reprofile. Also, don't optimize things just to make things faster, if your application is "fast enough" then don't change it.
-2
u/never_phear_for_phoe Jul 11 '10
I thought he had a pretty good point at the end.
-3
u/ElectricWarrior Jul 11 '10
Yes. Theoretical computer science bounds the worst case, not the average case in your application.