Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extend path cache duration? #53

Closed
paulirish opened this issue Jun 22, 2012 · 2 comments
Closed

extend path cache duration? #53

paulirish opened this issue Jun 22, 2012 · 2 comments

Comments

@paulirish
Copy link

I often want to z to a path i was last in like 3 weeks ago. But they seem to be unavailable.. i imagine they are being evicted from the cache..

I know this is one of the 2 hardest problems, but i'd like to see if we can cache evict smarter so my projects that i work on occasionally are still z-able

In my particular care, most of my projects are in ~/Sites/ and i'm zing around them, so the heuristic could give items within my Sites folder a longer expire time..

(But maybe I totally misundertand how it works, so apologies if so)

@rupa
Copy link
Owner

rupa commented Jun 22, 2012

I've actually been thinking about this recently ... my new job has a bit of a different workflow that my last, and I've been noticing dirs age out of the datafile earlier than I expect. Pretty much all of the numbers about this were picked arbitrarily, and there's several possibilities for tweaking/improving behavior. I would welcome suggestions from anyone that wishes to experiment, and believes they've found more intuitive 'settings'.

To that end, here's the stuff you can play around with:

  • See the lines:

    if( count > 1000 ) {
     for( i in rank ) print i "|" 0.9*rank[i] "|" time[i] # aging
    

    count is the sum of all the ranks (how many times you hit enter in a dir) in the datafile. Entries don't start getting aged out until the total rank count exceeds 1000. So, we can raise that number to delay aging.
    Whenever the count hits that threshold, every entry in the file is 'aged' by multiplying the rank by '0.9'. So, we can make that number closer to 1 to slow down aging.

  • A few lines up:

   $2 >= 1 {

When the rank on a directory goes below 1, it is dropped from the datafile. So we can lower that number to keep aged directories from being removed for a while longer.

Some combination of tweaks to these should yield better results for you.

Furthermore, it occurs to me that I don't mess with 'frecency' here, I only use it when weighting directories that are still in the datafile. It's possible that it would be a good idea to use that in aging calculation - but I can't really think of a way to use it that isn't arguably counterproductive.

I don't want to make these things configurable, I prefer z to be something that just works as intuitively as possible without fiddling, but these aren't very carefully chosen constants and I'm sure they could be better.

@rupa rupa mentioned this issue Jun 23, 2012
@twe4ked
Copy link

twe4ked commented Dec 4, 2012

I often run into this issue, I would love to see the time they stay around raised. Is there a good reason to kill any directory you have visited more then say 5 times?

I don't want to make these things configurable, I prefer z to be something that just works as intuitively as possible without fiddling, but these aren't very carefully chosen constants and I'm sure they could be better.

I pull z in using another tool so I can't easily modify the numbers without having them configurable somehow. Perhaps having an option to switch off removing directories from the index would work.

EDIT: That being said I also like things that just work. Maybe the numbers just need to be tweaked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants