On 30 October 2012 12:34, Dave Mitchell <davem@iabyn.com> wrote: > On Tue, Oct 30, 2012 at 05:31:55AM +1100, Peter Rabbitson wrote: >> As a data point - perl 5.8.1 is the only perl which actually behaves the >> way you propose (5.8.0 didn't randomize, and 5.8.2 got the rehash bit >> added). > > Indeed, based on the thread starting at > > Message-ID: <20031010024134.GE2004@perlsupport.com> > > it looks like the primary motivation for moving to rehash was to restore > the binary compatibility within the 5.8.x branch inadvertently broken by > 5.8.1. > > I'm not particularly keen on having hashes always randomised - it makes > debugging harder, and reproducing a reported issue nigh-on impossible; But this is the case now. You have no idea if the rehash logic has fired off when you debug, nor in which hashes. IMO, it will have the opposite effect, by making hash order dependency bugs much more obvious. Maybe this cheating for me to bring up :-), but consider the fence post error in the key traversal for the warnings logic. The tests were not putting keys in every bucket, and never in one of them. With randomization that test started failing occasionally, which revealed the bug. > but if Yves can show a measurable performance gain without the rehash > checks, My guess is it will be marginally measurable. But it is one of many marginally measurable improvements that could be made to the code. > then I'll approve, as long as the hash seed can still be > initialised with the env var PERL_HASH_SEED=0 - otherwise debugging > becomes impossible. Yes that is already possible. My patch did not remove that feature. However the way the seed is used in the current version of perls implementation of the one-at-a-time hash means that a 0 seed is about the absolute worst option possible. I therefore slightly changed how we use the seed to reduce the ease of creating collisions even when the seed is 0. This itself likely will break as much code that depends on a particular hash order as true hash randomization. cheers, Yves -- perl -Mre=debug -e "/just|another|perl|hacker/"Thread Previous | Thread Next