Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Re: Any Point in Uploading Tie::SortedHash

by Limbic~Region (Chancellor)
on Sep 05, 2003 at 22:31 UTC ( [id://289376]=note: print w/replies, xml ) Need Help??


in reply to Re: Any Point in Uploading Tie::SortedHash
in thread Any Point in Uploading Tie::SortedHash

Abigail,
My verbiage was incorrect. The code is a hybrid as you describe. The rebuild does not happen when a key is deleted, value is changed, etc. Only a flag is set that is checked when FIRSTKEY is called. A rebuild only happens under those circumstances.

In reference to deleting an array element taking time in linear proportion to the size of the array, no I was not aware of this. The two alternatives I can think of are:

  • Set the CHANGED flag and rebuild if FIRSTKEY is ever called again
  • Use more memory and delay the delete(s) until FIRSTKEY is called again. If in the interim the hash is modified, the rebuild would occur and the delete(s) would be forgotten. If FIRSTKEY was never called again, they would also be forgotten (albeit using some memory).

    Do you see a clear way to go?

    Cheers - L~R

    • Comment on Re: Re: Any Point in Uploading Tie::SortedHash
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Domain Nodelet?
    Node Status?
    node history
    Node Type: note [id://289376]
    help
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this?Last hourOther CB clients
    Other Users?
    Others perusing the Monastery: (4)
    As of 2025-06-15 05:59 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found

      Notices?
      erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.