Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
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

  • 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 having a coffee break in the Monastery: (5)
    As of 2024-03-28 15:58 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found