login
Header Space

 
 

Re: I'm a total push-over..

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Linus Torvalds <torvalds@...>
Cc: Dmitry Potapov <dpotapov@...>, Andreas Ericsson <ae@...>, Git Mailing List <git@...>, Junio C Hamano <gitster@...>
Date: Friday, January 25, 2008 - 4:52 pm

On 1/24/08, Linus Torvalds <torvalds@linux-foundation.org> wrote:

Well, although this is very clever approach, I suggest against it.
You'll end up with complex code that gives out substandard results.

I think its better to have separate case-folding function (or several),
that copies string to temp buffer and then run proper optimized hash
function on that buffer.

That way you can use already tested building blocks and can optimize
both sides separately.  Eg. the folding-only function can  aswell be
optimized to load 4 or 8-byte at-a-time.  This also isolates hashing
from exact details how folding happens to access the input string which
seem to be the weak point in your approach.  (In both collision and
complexity sense.)

Such temp buffer happens to fits my lookup3_memcpy also better (heh).
Its weak point is that on platforms that do not allow unaligned access,
it degenerates to byte-by-byte loading.  But if know you always
have aligned buffer, you can notify gcc to do 4-byte fetch there too.
It should be as simple as tagging data pointer as uint32_t *.

Anyway, now you dont need to worry about folding when picking hash.


If your input strings are over kilobyte on average then I'd
agree with you, but if you process 20-30 bytes on average,
is the additional complexity worth it?

-- 
marko
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
I'm a total push-over.., Linus Torvalds, (Tue Jan 22, 7:37 pm)
Re: I'm a total push-over.., Andreas Ericsson, (Wed Jan 23, 4:32 am)
Re: I'm a total push-over.., Linus Torvalds, (Wed Jan 23, 12:06 pm)
Re: I'm a total push-over.., Dmitry Potapov, (Wed Jan 23, 5:15 am)
Re: I'm a total push-over.., Andreas Ericsson, (Wed Jan 23, 5:31 am)
Re: I'm a total push-over.., Dmitry Potapov, (Wed Jan 23, 1:10 pm)
Re: I'm a total push-over.., Andreas Ericsson, (Thu Jan 24, 6:39 am)
Re: I'm a total push-over.., Marko Kreen, (Wed Jan 23, 10:01 am)
Re: I'm a total push-over.., Andreas Ericsson, (Wed Jan 23, 10:39 am)
Re: I'm a total push-over.., Marko Kreen, (Thu Jan 24, 9:19 am)
Re: I'm a total push-over.., Andreas Ericsson, (Thu Jan 24, 12:00 pm)
Re: I'm a total push-over.., Marko Kreen, (Fri Jan 25, 4:08 pm)
Re: I'm a total push-over.., Dmitry Potapov, (Thu Jan 24, 12:28 pm)
Re: I'm a total push-over.., Linus Torvalds, (Thu Jan 24, 1:15 pm)
Re: I'm a total push-over.., Marko Kreen, (Fri Jan 25, 4:52 pm)
Re: I'm a total push-over.., Linus Torvalds, (Fri Jan 25, 6:16 pm)
Re: I'm a total push-over.., Marko Kreen, (Sat Jan 26, 8:37 am)
Re: I'm a total push-over.., Marko Kreen, (Sat Jan 26, 8:16 am)
Re: I'm a total push-over.., Linus Torvalds, (Sun Jan 27, 2:51 am)
Re: I'm a total push-over.., Marko Kreen, (Sun Jan 27, 5:45 am)
Re: I'm a total push-over.., Dmitry Potapov, (Sun Jan 27, 11:06 am)
Re: I'm a total push-over.., Dmitry Potapov, (Sun Jan 27, 4:21 am)
Re: I'm a total push-over.., Johannes Schindelin, (Sun Jan 27, 10:07 am)
Re: I'm a total push-over.., Dmitry Potapov, (Sun Jan 27, 10:48 am)
Re: I'm a total push-over.., Linus Torvalds, (Fri Jan 25, 6:35 pm)
Re: I'm a total push-over.., Dmitry Potapov, (Thu Jan 24, 2:45 pm)
Re: I'm a total push-over.., Linus Torvalds, (Thu Jan 24, 3:08 pm)
Re: I'm a total push-over.., Marko Kreen, (Thu Jan 24, 12:13 pm)
Re: I'm a total push-over.., Luke Lu, (Thu Jan 24, 2:51 am)
Re: I'm a total push-over.., Andreas Ericsson, (Thu Jan 24, 6:24 am)
Re: I'm a total push-over.., Junio C Hamano, (Tue Jan 22, 10:23 pm)
Re: I'm a total push-over.., Linus Torvalds, (Tue Jan 22, 10:58 pm)
Re: I'm a total push-over.., Junio C Hamano, (Wed Jan 23, 3:23 am)
Re: I'm a total push-over.., Johannes Schindelin, (Wed Jan 23, 8:25 am)
Re: I'm a total push-over.., Linus Torvalds, (Wed Jan 23, 12:25 pm)
Re: I'm a total push-over.., Johannes Schindelin, (Wed Jan 23, 12:34 pm)
Re: I'm a total push-over.., Linus Torvalds, (Wed Jan 23, 1:09 pm)
Re: I'm a total push-over.., Linus Torvalds, (Wed Jan 23, 1:29 pm)
Re: I'm a total push-over.., Jeremy Maitin-Shepard, (Fri Jan 25, 1:21 am)
Re: I'm a total push-over.., Johannes Schindelin, (Fri Jan 25, 8:51 am)
Re: I'm a total push-over.., Jeremy Maitin-Shepard, (Fri Jan 25, 2:19 pm)
Re: I'm a total push-over.., Junio C Hamano, (Fri Jan 25, 3:07 pm)
Re: I'm a total push-over.., Johannes Schindelin, (Fri Jan 25, 2:24 pm)
Re: I'm a total push-over.., Linus Torvalds, (Tue Jan 22, 11:19 pm)
Re: I'm a total push-over.., Junio C Hamano, (Fri Jan 25, 2:50 am)
Re: I'm a total push-over.., Linus Torvalds, (Fri Jan 25, 12:24 pm)
Re: I'm a total push-over.., Junio C Hamano, (Tue Jan 22, 10:36 pm)
Re: I'm a total push-over.., Johannes Schindelin, (Wed Jan 23, 8:24 am)
Re: I'm a total push-over.., David Kastrup, (Wed Jan 23, 8:28 am)
Re: I'm a total push-over.., Theodore Tso, (Wed Jan 23, 8:56 am)
Re: I'm a total push-over.., Kevin Ballard, (Tue Jan 22, 9:35 pm)
speck-geostationary