zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: "zsh-workers@zsh.org" <zsh-workers@zsh.org>
Subject: Re: [BUG] APPEND_HISTORY leads to complete reread + rewrite of histfile
Date: Wed, 6 Dec 2017 11:51:02 -0800	[thread overview]
Message-ID: <CAH+w=7bSdmPztA59b2DpAPxWN6-P0vqpYy7Qr6V_JtUdOvkc7g@mail.gmail.com> (raw)
In-Reply-To: <20171206193122.w4r3dhkotlhdtrah@local>

On Wed, Dec 6, 2017 at 11:31 AM, Zeshy <ml.zsh@gmx.es> wrote:
> Hi all!
>
> In search of the reason why zsh (5.4.2 and fairly recent git) is
> so much slower reading/writing larger history files (13 MB, 330k lines)
> than bash (4.4.12), I think I found a bug. If I missed something (like
> some option), and this is not a bug, but just misconfiguration, or if
> you need more information, please let me know.

This happens because of HISTSIZE and the various HIST_*DUP* options.
The only way to do duplicate filtering is to examine the entire past
history, and there's no setting of HISTSIZE that is interpreted as
"unlimited" so rewriting to output only the most recent $HISTSIZE
lines is always performed.

It would probably be possible to optimize for the case of "$HISTSIZE
is larger than the current number of lines and no duplicate removal is
enabled" but right now there is just one rewriting algorithm that
applies (or not) those conditions internal to the loop.

So not technically a bug but not optimized for people who can "afford"
the memory cost to have every shell preserve huge amounts of history.


  reply	other threads:[~2017-12-06 19:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-06 19:31 Zeshy
2017-12-06 19:51 ` Bart Schaefer [this message]
2017-12-06 19:52   ` Bart Schaefer
2017-12-21 20:52   ` Zeshy

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=7bSdmPztA59b2DpAPxWN6-P0vqpYy7Qr6V_JtUdOvkc7g@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@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).