zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh Users <zsh-users@zsh.org>, Robin Dapp <rdapp@linux.vnet.ibm.com>
Subject: Re: Memory usage of history?
Date: Fri, 24 Jun 2016 18:47:47 -0700	[thread overview]
Message-ID: <CAH+w=7YQz6iaJf0k=OkX2bQSL26ohU3wLRVYgki_Z6jLOYpzSw@mail.gmail.com> (raw)
In-Reply-To: <20160624134706.GA22704@linux.vnet.ibm.com>

On Fri, Jun 24, 2016 at 6:47 AM, Dominik Vogt <vogt@linux.vnet.ibm.com> wrote:
>
> (A colleague
> says his zshs use 200 MB memory each with a history size of a
> million lines).

To expand on Eric's answer, zsh reads the entire $HISTFILE and retains
the last $HISTSIZE entries.  So a large $HISTFILE also slows down
startup, even if it doesn't consume lots of memory.

I can't imagine anyone having a million useful lines of history.  A
few tens of thousands at most.  Things he might consider that would
allow him to reduce SAVEHIST and/or HISTSIZE without losing too much
information:
* Set the hist_ignore_all_dups option, if he doesn't already.
* Set the hist_save_no_dups option, similarly.
* Define a zshaddhistory function to filter out commands that are
unlikely to be used again.

If he isn't already ignoring / not saving duplicates, an interesting
experiment might be to add hist_ignore_all_dups without changing
HISTSIZE, then run zsh and see how many lines of history actually end
up being retained.


  parent reply	other threads:[~2016-06-25  1:47 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 [this message]
2016-06-25 17:33   ` Nikolay Aleksandrovich Pavlov (ZyX)
2016-06-25 17:46     ` Bart Schaefer
2016-06-26 23:29     ` Bart Schaefer
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='CAH+w=7YQz6iaJf0k=OkX2bQSL26ohU3wLRVYgki_Z6jLOYpzSw@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=rdapp@linux.vnet.ibm.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).