zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh Users <zsh-users@zsh.org>
Subject: Re: Memory usage of history?
Date: Sun, 26 Jun 2016 16:29:18 -0700	[thread overview]
Message-ID: <160626162918.ZM20803@torch.brasslantern.com> (raw)
In-Reply-To: <6323851466876031@web5m.yandex.ru>

On Jun 25,  8:33pm, Nikolay Aleksandrovich Pavlov (ZyX) wrote:
} Subject: Re: Memory usage of history?
}
} 1. allows saving user-defined metada in history file and

I'm not sure the answer to the history file being too large is to
make it even larger by cramming in all sorts of other data.  This
would be even slower to parse at load time as well.

} 2. allows user to get control over what exactly will be removed.

In addition to all the other stuff I mentioned, I forgot about the
relatively recent addition of the HISTORY_IGNORE variable, which can
be a pattern that matches lines to leave out.  That would be the
best way to handle my "foo is a throwaway" and similar criteria.

} Specifically first may be used to save information about
} 
} 1. How often the command is used (total number of uses, anything else like
}    "uses per month" would be harder to determine).
} 2. Time it took command to type (when it was typed for the first time)
}    (time between first self-insert (or $*BUFFER modification if it was
}    constructed by a widget) and accept-line).
} 3. Last time command was run.
} 4. Time it took command to finish (average among all runs).
} 5. What was the exit code (hash exit code - number of times it occurred).

I find these to be very unlikely criteria for deciding what's interesting
in the history?

For one thing, "time it took to type" is going to be really hard to get
right; multi-line commands have multiple accept-line calls, and you'd
have to filter out commands that were recalled from the history or you'd
get an average much too small.

Larger number of uses would be skewed towards really simple things, and
in fact (at least in my own case) the LESS often I use a command, the
more likely I am to want it from the history (unless it's one of those
throwaways I mentioned in another message), because I can remember the
ones I use a lot without zsh's help.  If I use it often enough, I can
make an alias or keybinding for it and not need to search history.

How long the command took to run seems entirely unrelated to whether
it is history-worthy (and also doesn't work with shared/incremental
history). What would you use the exit code for, except maybe weeding
out typos?

I like Christian Neukirchen's idea of maintaining a daily archive.
Adding a function / keybinding to search through an alternate history
store seems more manageable than either having a huge history always
in memory or a complicated AI for storing only interesting bits.


  parent reply	other threads:[~2016-06-26 23:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-24 13:47 Dominik Vogt
2016-06-24 22:57 ` Eric Cook
2016-06-25  1:47 ` Bart Schaefer
2016-06-25 17:33   ` Nikolay Aleksandrovich Pavlov (ZyX)
2016-06-25 17:46     ` Bart Schaefer
2016-06-26 23:29     ` Bart Schaefer [this message]
2016-06-27  0:23       ` Nikolay Aleksandrovich Pavlov (ZyX)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=160626162918.ZM20803@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).