Messages in this thread | ![/](/images/icornerl.gif) | | Date | Wed, 30 Apr 2003 08:28:42 -0700 (PDT) | From | Linus Torvalds <> | Subject | Re: [RFC][PATCH] Faster generic_fls |
| |
On 30 Apr 2003, Falk Hueffner wrote: > Linus Torvalds <torvalds@transmeta.com> writes: > > > Classic mistake. Lookup tables are only faster in benchmarks, they > > are almost always slower in real life. You only need to miss in the > > cache _once_ on the lookup to lose all the time you won on the > > previous one hundred calls. > > It seems to me if you call the function so seldom the table drops out > of the cache, it is irrelevant how long it takes anyway.
Yeah, but then this whole discussion is irrelevant too.
I'm just saying that micro-benchmarks of operations that do not make any sense on their own are _bad_ measures of real performance. That lookup is going to lose to the "natural" code even if it hits the L2, and misses only the L1.
Any piece of code that only works well when it sits in (and owns) the L1 is a piece of crap.
> Well, if a lookup table isn't "small and simple", I don't know what > is.
Something that calculates it directly? Like, perchance, the current code?
There is _never_ any excuse to use a lookup table for something that can be calculated with a few simple instructions. That's just stupid.
Linus
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| ![\](/images/icornerr.gif) |