Re: Bob Jenkins' hashing implementation in Ruby
From:
Mauricio Fern疣dez <batsman.geo@...>
Date:
2003-03-01 18:55:37 UTC
List:
ruby-core #899
On Sun, Mar 02, 2003 at 03:28:45AM +0900, nobu.nokada@softhome.net wrote:
> Hi,
>
> At Sun, 2 Mar 2003 03:05:36 +0900,
> Mauricio Fern疣dez wrote:
> > What about the following?
> > I get a speed increase of 3% (compared to the non-inlined version)
> > with the second test of the GCLS.
> > I eliminate 2 instructions per iteration (on x86) out of 10 in the loop.
> > It's OK to use compiler extensions if we detect them in configure, isn't
> > it?
>
> Instead, use -funroll-loops option for gcc.
>
> And you don't need compiler extensions at all in this case:
>
Duh!
>
> Or famous tricky code:
>
> if (len > 0) {
> switch (len & 31) {
> do {
> case 0: key = key*65599 + *p++;
> case 31: key = key*65599 + *p++;
> case 30: key = key*65599 + *p++;
> case 29: key = key*65599 + *p++;
> case 28: key = key*65599 + *p++;
> /* snip */
> case 1: key = key*65599 + *p++;
> } while ((len -= 32) > 0);
> }
> }
Why isn't that in use right now?
You can argue that -funroll-loops does the same, but a lot of people are
using the binary supplied by their vendor, compiled without "strange"
options...
--
_ _
| |__ __ _| |_ ___ _ __ ___ __ _ _ __
| '_ \ / _` | __/ __| '_ ` _ \ / _` | '_ \
| |_) | (_| | |_\__ \ | | | | | (_| | | | |
|_.__/ \__,_|\__|___/_| |_| |_|\__,_|_| |_|
Running Debian GNU/Linux Sid (unstable)
batsman dot geo at yahoo dot com
I'm telling you that the kernel is stable not because it's a kernel,
but because I refuse to listen to arguments like this.
-- Linus Torvalds