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 

Searching Atribute-Value lists

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





PostPosted: Thu Jan 05, 2006 10:26 am    Post subject: Searching Atribute-Value lists Reply with quote



Hi,

I have a number of attrib-value lists with differing
number of these pairs.

The memory that these lists take up is insignificant
but the speed is.

So, I tried various techniques. One of which was to
use DAWGs (directed acyclic word graphs). The I used
binary search. All were sort of OK.

The fastest I could come up with is a class with an

array [LengthOfString] of array[SortedAttribValuePairs]

This turns out to be fastest with binary search.

So, obviously, my question is: Is there a faster method?
Back to top
Pierre le Riche
Guest





PostPosted: Thu Jan 05, 2006 2:48 pm    Post subject: Re: Searching Atribute-Value lists Reply with quote



Hi Adem,

A problem with binary searching is that it is tough on the CPU's branch
predictor. However, if you're comparing strings then I would guess that is
not a significant factor, since string comparisons tend to be expensive -
much more expensive than a branch mispredict.

Have you tried hash tables?

Regards,
Pierre


Back to top
Adem
Guest





PostPosted: Fri Jan 06, 2006 2:01 am    Post subject: Re: Searching Atribute-Value lists Reply with quote



Pierre le Riche wrote:

Hi Pierre,

Quote:
Have you tried hash tables?

I just did. They are not --so far-- faster than my cludgy solution.

The one thing I noticed is how important the hash function is. They
make or break the whole thing.

I have tried a number of CRC32 functions. And, the assembler one
I found turned out to be %10 slower than pascal one (D7); go figure..

You wouldn't by any chance be in a position to suggest some hash
function that is FAST --please <g>

Cheers,
Adem

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.