Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^2: Re-orderable keyed access structure?

by BrowserUk (Pope)
on Aug 14, 2004 at 15:17 UTC ( #382975=note: print w/replies, xml ) Need Help??


in reply to Re: Re-orderable keyed access structure?
in thread Re-orderable keyed access structure?

Thanks L~R, but it you take a look at 382970, you'll see that the "ordering" isn't sorting.

The re-ordering occurs when a hash element is accessed, according to a hueristic that includes (for example), if a hash element is required that isn't currently being held in the (internal) array, then the lowest ordered item in the array may be discarded to accomodate the called for item. However, an item's position in the array is adjusted each time it is accessed (always by key).

If an item has been STORE'd to, the underlying item will have been modified and so discarding it from the array will require an update to the backing store first.

If the item has only ever been FETCH'd, discarding it is cheaper as the backing store doesn't need an update.

The hueristic can also take into account the frequency of access and/or the recentness(better word?) (or otherwise), of it's last access.

As you can see, this doesn't easily translate into a sort criteria that could be used with your module. (Unless you can see a way :).

Thanks again.


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail
"Memory, processor, disk in that order on the hardware side. Algorithm, algorithm, algorithm on the code side." - tachyon
  • Comment on Re^2: Re-orderable keyed access structure?

Replies are listed 'Best First'.
Re^3: Re-orderable keyed access structure?
by Limbic~Region (Chancellor) on Aug 14, 2004 at 15:23 UTC
    BrowserUk,
    Ok, in light of this further explanation - Tie::Hash::Sorted isn't for you. To be honest, I only read the root node in the thread which didn't include these details. I do want to point out that sorted can be equal to ordered if the sort routine uses a lexical that defines that order. That is one of the great things about the module - the sort routine can be anything you dream up to include defining the specific order 1 by 1.

    Cheers - L~R

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2020-10-30 17:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (282 votes). Check out past polls.

    Notices?