in reply to Re: Re: Eek! goto?
in thread Eek! goto?
Abigail
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Eek! goto?
by BrowserUk (Patriarch) on Feb 12, 2003 at 15:43 UTC | |
If it were not for pfaut's unpack suggestion, I almsot certainly would be using it, but the loss of performance of the perl implimentation relative to the C switch version means pushing as much of the work into perl as I can has dividends. The original C code is here. My current best perl implementation of the while thing is the hash2() in the test code below. hash() being my original brute force conversion. The two version appear to function the same as each other, with the unpack version coming out about %50 faster. However, the number of first pass collisions worries me a little. It could be just be a function of the limited range of inputs, but its higher than I expected. The other possibility is that both implementations are equally wrong. If you (or anyone) has a few moments to compare the perl and the C versions and point out any obvious differences I'd be grateful. Also, if anyone has any idea's or pointers for methods of testing the goodness of this type of hashing function I'd really like to hear/see them. Unfortunately, the vast majority of the hits on google relate to hashing fuctions used for cryptography which is a completly different ballpark. I'm slowly whittling them down and wading through them, but haven't found anything applicable yet. My test code Read more... (3 kB)
Benchmark results
Examine what is said, not who speaks. The 7th Rule of perl club is -- pearl clubs are easily damaged. Use a diamond club instead. | [reply] [d/l] [select] |
by Abigail-II (Bishop) on Feb 12, 2003 at 16:09 UTC | |
And it would also be interesting to benchmark the two. Abigail | [reply] |
by BrowserUk (Patriarch) on Feb 12, 2003 at 16:26 UTC | |
That would be ideal. Unfortunately I am still hamstrung trying to build my own version of Perl using MingW and don't have the money or inclination to shell out for MSVC++ (which is what it appears AS use to build their distributions). The problem I have hit is
Which from google appears to be a problem with the MinGW libraries rather than the perl source as I found evidence of similar problems when it's used to build various other things including CygWin, Ruby and Python. I've found nothing that relates to this problem when building perl, but whilst the docs suggest building Perl for Win32 using MinGW and DMAKE is possible, I've found little real information on the subject so far, and my requests here for assistance have been met with a stoney silence. It seems noone else has succeeded doing this either...? Examine what is said, not who speaks. The 7th Rule of perl club is -- pearl clubs are easily damaged. Use a diamond club instead. | [reply] [d/l] |
by pfaut (Priest) on Feb 12, 2003 at 15:58 UTC | |
Looks like a typo in hash(). Should the third line inside the while loop be $c = ...?
| [reply] [d/l] [select] |