[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Does anyone have a better scm_string_hash ?
From: |
Allister MacLeod |
Subject: |
Re: Does anyone have a better scm_string_hash ? |
Date: |
Mon, 17 Nov 2003 11:48:20 -0500 |
User-agent: |
Mutt/1.5.4i |
On Mon, Nov 17, 2003 at 05:29:48PM +0100, Marius Vollmer wrote:
> Marius Vollmer <address@hidden> writes:
> > Just for kicks, I'm now going to see what kind of code GCC generates
> > for h*37 as compared to (h<<5) + (h<<2) + h...
> Interesting. For h = a + (h<<5) + (h<<2) + h we get this sequence
> (one line is one machine instruction):
> x = h
> x = x << 5
> a = a + x
> a = a + h*4
> h = a + h
> and for h = a + h*37 we get
> x = h + h*8
> x = h + x*4
> h = x + a*1
> which is nearly twice as clever...
Just for reference, what are the timings on a Pentium for these
instructions? I assume from your pleased comments that
assign-from-plus-and-multiply is sufficiently fast that two of them
are less costly than a pair of assign-from-plus, an assign-from-shift,
and an assignment. I'm curious as to why the last line of the second
way ends up being h=x+a*1, instead of h=x+a. Are a series of
same-width instructions faster than ones with different widths?
(gawd, CISC rox, bleh)
Cheers,
Allister
--
Allister MacLeod <address@hidden> | http://amacleod.is-a-geek.org/
Elen síla lúmenn'omentielvo.
- Re: cmod-play 1 available + modsup.h additions, (continued)
- Re: cmod-play 1 available + modsup.h additions, Marius Vollmer, 2003/11/14
- Does anyone have a better scm_string_hash ?, Roland Orre, 2003/11/14
- Re: Does anyone have a better scm_string_hash ?, Ludovic Courtès, 2003/11/14
- Re: Does anyone have a better scm_string_hash ?, Roland Orre, 2003/11/17
- Re: Does anyone have a better scm_string_hash ?, Ludovic Courtès, 2003/11/17
- Re: Does anyone have a better scm_string_hash ?, Marius Vollmer, 2003/11/17
- Re: Does anyone have a better scm_string_hash ?, Marius Vollmer, 2003/11/17
- Re: Does anyone have a better scm_string_hash ?, Marius Vollmer, 2003/11/17
- Re: Does anyone have a better scm_string_hash ?,
Allister MacLeod <=
- Re: Does anyone have a better scm_string_hash ?, Marius Vollmer, 2003/11/17
- OT: x86 assembly timings/size (was Re: Does anyone have a better scm_string_hash ?), Allister MacLeod, 2003/11/17
- Re: OT: x86 assembly timings/size, Marius Vollmer, 2003/11/17
- Re: Does anyone have a better scm_string_hash ?, Ludovic Courtès, 2003/11/19
- Re: Does anyone have a better scm_string_hash ?, Marius Vollmer, 2003/11/19
Re: cmod-play 1 available + modsup.h additions, Thien-Thi Nguyen, 2003/11/14