BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Any known fast hash algorithms ?

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Language BASM
View previous topic :: View next topic  
Author Message
Juhani Suhonen
Guest





PostPosted: Thu May 17, 2007 9:00 pm    Post subject: Any known fast hash algorithms ? Reply with quote



I need very fast hashing function for arbitrary length
strings in type of function hash(constr str:string):longword
dispersion probability is not big problem since I'm using
results in stringhash table which validates inputs if similar
value already exists,

tia


Juhani Suhonen

btw. I'm currently using (from Mr. Diazgov)
---
function Q_StrHashKey(const S: string): LongWord;
asm
TEST EAX,EAX
JE @@qt
LEA EDX,[EAX-1]
MOV ECX,[EAX-4]
XOR EAX,EAX
TEST ECX,ECX
JE @@qt
PUSH ESI
PUSH EBX
@@lp: MOV ESI,EAX
SHL EAX,5
MOVZX EBX,BYTE PTR [EDX+ECX]
ADD EAX,ESI
ADD EAX,EBX
DEC ECX
JNE @@lp
POP EBX
POP ESI
@@qt:
end;
Back to top
Davy Landman
Guest





PostPosted: Thu May 17, 2007 11:37 pm    Post subject: Re: Any known fast hash algorithms ? Reply with quote



elf hash?
by Aleksandr Sharahov:
function ElfHash_Sha(const s: string): integer;
asm
mov edx, eax
xor eax, eax
test edx, edx
jz @Ret
sub eax, [edx-4]
jz @Ret
mov ecx, eax
sub edx, eax
xor eax, eax
push ebx
@Loop:
movzx ebx, [edx+ecx]
add ebx, eax
lea eax, [ebx+ebx]
shr ebx, 20
lea eax, [8*eax]
and ebx, $0F00
xor eax, ebx
add ecx, 1
jnz @Loop
shr eax, 4
pop ebx
@Ret:
end;

a very good hashing function y Paul Heish:

http://www.azillionmonkeys.com/qed/hash.html"
Quote:
Update(6): In Google's open source "sparse hash table" project, the
documentation makes the following observation: " ... in one test of the
default SGI STL string hash function against the Hsieh hash function ...,
for a particular set of string keys, the Hsieh function resulted in
hashtable lookups that were 20 times as fast as the STLPort hash function.
The string keys were chosen to be "hard" to hash well, so these results may
not be typical, but they are suggestive."

"Juhani Suhonen" <juhani.suhonen (AT) a1netti (DOT) cmo> wrote in message
news:464c7c2b (AT) newsgroups (DOT) borland.com...
Quote:
I need very fast hashing function for arbitrary length
strings in type of function hash(constr str:string):longword
dispersion probability is not big problem since I'm using
results in stringhash table which validates inputs if similar
value already exists,

tia


Juhani Suhonen

btw. I'm currently using (from Mr. Diazgov)
---
function Q_StrHashKey(const S: string): LongWord;
asm
TEST EAX,EAX
JE @@qt
LEA EDX,[EAX-1]
MOV ECX,[EAX-4]
XOR EAX,EAX
TEST ECX,ECX
JE @@qt
PUSH ESI
PUSH EBX
@@lp: MOV ESI,EAX
SHL EAX,5
MOVZX EBX,BYTE PTR [EDX+ECX]
ADD EAX,ESI
ADD EAX,EBX
DEC ECX
JNE @@lp
POP EBX
POP ESI
@@qt:
end;


Back to top
danny heijl
Guest





PostPosted: Sat May 19, 2007 2:11 am    Post subject: Re: Any known fast hash algorithms ? Reply with quote



Juhani Suhonen schreef:

Quote:
I need very fast hashing function for arbitrary length
strings in type of function hash(constr str:string):longword
dispersion probability is not big problem since I'm using
results in stringhash table which validates inputs if similar
value already exists,

I implemented Bob Jenkins' Lookup2 hash function in Pascal when I had to
write a high-performance hashtable (holding millions of entries).

Lookup2 is very fast with nearly perfect distribution for strings of any
size.

It has been in use for several years now performing millions of hashses
a day for me.

Danny
---
Back to top
Juhani Suhonen
Guest





PostPosted: Sat May 19, 2007 3:46 pm    Post subject: Re: Any known fast hash algorithms ? Reply with quote

Any fast basm implementations available ?


Juhani Suhonen

"danny heijl" <danny_dot_heijl_at_telenet_dot_be> wrote in message
news:464e1676$1 (AT) newsgroups (DOT) borland.com...
Quote:
Juhani Suhonen schreef:

I need very fast hashing function for arbitrary length
strings in type of function hash(constr str:string):longword
dispersion probability is not big problem since I'm using
results in stringhash table which validates inputs if similar
value already exists,

I implemented Bob Jenkins' Lookup2 hash function in Pascal when I had to
write a high-performance hashtable (holding millions of entries).

Lookup2 is very fast with nearly perfect distribution for strings of any
size.

It has been in use for several years now performing millions of hashses a
day for me.

Danny
---
Back to top
danny heijl
Guest





PostPosted: Sat May 19, 2007 6:40 pm    Post subject: Re: Any known fast hash algorithms ? Reply with quote

Juhani Suhonen schreef:

Quote:
Any fast basm implementations available ?

Not that I know of, and the code generated by the compiler is good
enough for me (although I made some tweaks after inspecting the
generated code in the CPU window).

Danny
---
Back to top
Juhani Suhonen
Guest





PostPosted: Sat May 19, 2007 11:16 pm    Post subject: Re: Any known fast hash algorithms ? Reply with quote

Could you share it ? (my basm skills are bit rusted, but i'll try
my best later today evening...)

Juhani Suhonen

"danny heijl" <danny_dot_heijl_at_telenet_dot_be> wrote in message
news:464efe5f (AT) newsgroups (DOT) borland.com...
Quote:
Juhani Suhonen schreef:

Any fast basm implementations available ?

Not that I know of, and the code generated by the compiler is good enough
for me (although I made some tweaks after inspecting the generated code in
the CPU window).

Danny
---
Back to top
danny heijl
Guest





PostPosted: Sun May 20, 2007 6:14 pm    Post subject: Re: Any known fast hash algorithms ? Reply with quote

Juhani Suhonen schreef:

Quote:
Could you share it ? (my basm skills are bit rusted, but i'll try
my best later today evening...)

I didn't use any basm, just tweaked the Pascal code a bit based on what
I saw in the CPU view.

My Pascal version should be in your mailbox.

Danny
---
Back to top
Q Correll
Guest





PostPosted: Sun May 20, 2007 11:55 pm    Post subject: Re: Any known fast hash algorithms ? Reply with quote

danny,

| My Pascal version should be in your mailbox.

Would you please consider passing it along to me as well? I USED to
write my own hashing functions. <g.

TIA,

--
Q

05/20/2007 11:54:42

XanaNews Version 1.17.5.7 [Q's salutation mod]
Back to top
danny heijl
Guest





PostPosted: Mon May 21, 2007 12:15 am    Post subject: Re: Any known fast hash algorithms ? Reply with quote

Q Correll schreef:

Quote:
Would you please consider passing it along to me as well?

done

danny
---
Back to top
Juhani Suhonen
Guest





PostPosted: Mon May 21, 2007 9:45 pm    Post subject: Re: Any known fast hash algorithms ? Reply with quote

Could you please repost (my correct mail address is)
juhani <dot> suhonen <at> a1netti <dot> com

tia....

Juhani Suhonen

"danny heijl" <danny_dot_heijl_at_telenet_dot_be> wrote in message
news:4650499f (AT) newsgroups (DOT) borland.com...
Quote:
Juhani Suhonen schreef:

Could you share it ? (my basm skills are bit rusted, but i'll try
my best later today evening...)

I didn't use any basm, just tweaked the Pascal code a bit based on what I
saw in the CPU view.

My Pascal version should be in your mailbox.

Danny
---
Back to top
Q Correll
Guest





PostPosted: Mon May 21, 2007 10:15 pm    Post subject: Re: Any known fast hash algorithms ? Reply with quote

danny,

| done

Got it.

Thank you very much!!!

--
Q

05/21/2007 10:15:33

XanaNews Version 1.17.5.7 [Q's salutation mod]
Back to top
danny heijl
Guest





PostPosted: Tue May 22, 2007 2:11 am    Post subject: Re: Any known fast hash algorithms ? Reply with quote

Juhani Suhonen schreef:


Quote:
Could you please repost (my correct mail address is)
juhani <dot> suhonen <at> a1netti <dot> com

Ok, didn't notice the .cmo ...

Danny
---
Back to top
Terry
Guest





PostPosted: Tue May 22, 2007 5:07 am    Post subject: Re: Any known fast hash algorithms ? Reply with quote

Quote:
It has been in use for several years now performing millions of hashses a
day for me.

Could I get that also ?

Thank you,
Terry.
Back to top
danny heijl
Guest





PostPosted: Tue May 22, 2007 8:11 am    Post subject: Re: Any known fast hash algorithms ? Reply with quote

Terry schreef:

Quote:
Could I get that also ?

done.

danny
---
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Language BASM All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.