in reply to Devel::Peek hashref.

Devel::Peek::Dump is just a wrapper around dump.c Perl_do_sv_dump function, and after examining it I think it is an histogram of the keys per hash slot.

For your sample hash it means that there are 406794 slots with 0 keys, 382690 slots with 1 key, 182129 slots with 2 keys, etc.

That also means, that your idea of sorting the keys in every slot and then performing a merge is not going to have a great performance... though, you could degrade the hash to use just one slot while you are processing it.

Replies are listed 'Best First'.
Re^2: Devel::Peek hashref.
by BrowserUk (Patriarch) on Sep 23, 2010 at 17:16 UTC

    Ah yes. That makes sense.

    FILL = 641782 + 0:406794 = MAX = 1048575

    sum( 1:382690, 2:182129, 3:58962, 4:14525, 5:2894, 6:489, 7:84, 8:8, 10:1 ) == FILL = 641782.

    Thanks.

    This hash contains just test data. Namely 'AAAAAA'++ 1e6 times. So, (hopefully), this distribution is not representative of real data :)


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.