 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Adem Guest
|
Posted: Thu Jan 05, 2006 10:26 am Post subject: Searching Atribute-Value lists |
|
|
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
|
Posted: Thu Jan 05, 2006 2:48 pm Post subject: Re: Searching Atribute-Value lists |
|
|
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
|
Posted: Fri Jan 06, 2006 2:01 am Post subject: Re: Searching Atribute-Value lists |
|
|
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 |
|
 |
|
|
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
|
|