develooper Front page | perl.perl5.porters | Postings from July 2018

regen/ aka regen/ infinite loop?

Thread Next
bulk 88
July 2, 2018 10:18
regen/ aka regen/ infinite loop?
Message ID:
I tried to reuse the MinimalPerfectHash code in regen/ for another 
use in core. I tried to run regen/ and overnight, it is 
still running at max CPU.

I wrote a cut down case of regen/ as and attached 
that, and is also an infinite loop. Is this MPH code only 
correctly work on a 64 bit int perl (I am using 32 bit int perl)? or 
only works correctly on KHW's machine? I'll note regen/ is 
not executed by the typical p5p "" tool.

Console output:
No preprocessing, initial blob size 0
Length old blob: 8124 length new blob: 8248, keeping old blob
Using preprocessing, initial blob size 30002
Length old blob: 30121 length new blob: 8018, recomputing using new blob
Length old blob: 8533 length new blob: 8486, recomputing using new blob
Length old blob: 8486 length new blob: 8458, recomputing using new blob
Length old blob: 8458 length new blob: 8383, recomputing using new blob
Length old blob: 8383 length new blob: 8383, keeping old blob
Using greedy-smart blob, length: 8124 (vs 8383)
******infinite100% CPU hang at this****

Using a debugger shows sub _fnv always returns 4294967295 aka 0xFFFFFFFF 
no matter what the seed number is after an hour of running random seed 
numbers through. I've isolated this into  The 4294967295 aka 
0xFFFFFFFF number causes the infinite loop because $max_h is
4294965933  aka 0xFFFFFAAD.
    for ($seed1++;1;$seed1++) {
        my %hash_to_key;
        my %key_to_hash;
        my %key_buckets;
        my %high;
        $length_all_keys= 0;
        foreach my $key (sort keys %$hash) {
            $length_all_keys += length $key;
            my $h= _fnv($key,$seed1);
            next SEED1 if $h >= $max_h; #NOW BACK TO SEED1 LABEL FOREVER 
because $h always 4294967295

does work (not infinite loop) for anyone?

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About