zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: dominik.vogt@gmx.de, Zsh Users <zsh-users@zsh.org>
Subject: Re: SSD-friendly history
Date: Wed, 5 Oct 2022 23:10:43 -0700	[thread overview]
Message-ID: <CAH+w=7ZYnFFPxfPkifb=atH-twC8jc53DvYv2Voz0B4SPpYOkg@mail.gmail.com> (raw)
In-Reply-To: <Yz4Q7heV7qSUD0ik@localhost>

On Wed, Oct 5, 2022 at 4:19 PM Dominik Vogt <dominik.vogt@gmx.de> wrote:
>
> Disk space is not an issue.  So, if I set
>
>   SAVEHIST=120000
>   HISTSIZE=100000
>
> Then only 100.000 lines are loaded when the shell starts?

The shell will read all 120000 lines and keep the last (most recent)
100000 of them.  So there's a slight startup speed penalty.

> But how does this interact with duplicate handling, especially
> with HIST_EXPIRE_DUPS_FIRST?

Duplicate handling all happens on the in-memory history.   This means
anything that suppresses duplicates from the HISTFILE (such as
HIST_SAVE_NO_DUPS) will end up reducing it to HISTSIZE lines even if
SAVEHIST is larger.  The doc thus recommends setting HISTSIZE larger
than SAVEHIST in the case of HIST_EXPIRE_DUPS_FIRST so that you don't
immediately begin discarding your saved history as commands are
entered (which might be important if e.g. you use
accept-and-infer-next-history a lot).  However, if you use
INC_APPEND_HISTORY, duplicates are removed from HISTFILE only when
that file is rewritten (at SAVEHIST + 20% while the shell is
incrementally appending, or at shell exit).  So in that case having
SAVEHIST larger than HISTSIZE can be useful.

(These are details that didn't come up in an earlier zsh-workers
thread about default values for SAVEHIST and HISTSIZE and whether/when
it makes sense for them to differ.)


      reply	other threads:[~2022-10-06  6:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-05 21:34 Dominik Vogt
2022-10-05 22:50 ` Bart Schaefer
2022-10-05 23:19   ` Dominik Vogt
2022-10-06  6:10     ` Bart Schaefer [this message]

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='CAH+w=7ZYnFFPxfPkifb=atH-twC8jc53DvYv2Voz0B4SPpYOkg@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=dominik.vogt@gmx.de \
    --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).