in reply to In-place sort with order assignment

Out of curiosity, when the "fairly large hash (keys, no values)" is created, are the keys being created in the correct "sorted" order?

If the answer is yes, then I think that Tie::IxHash may be helpful in that will "preserve the order in which the hash elements were added", which eliminates the need to sort the keys after creating them.

If the answer is no, then the module suggestion above probably wouldn't be much help. Not sure what to suggest for this scenario.

  • Comment on Re: In-place sort with order assignment

Replies are listed 'Best First'.
Re^2: In-place sort with order assignment
by BrowserUk (Patriarch) on Sep 19, 2010 at 21:40 UTC
    are the keys being created in the correct "sorted" order?

    Unfortunately not. Otherwise I could just assign the values at the same time I create the keys.

    Also, the implementation of Tie::IxHash is such that it consumes ~3x times the memory of a standard hash.


    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.