zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-users@zsh.org
Subject: Re: delay in exitting from zsh shell
Date: Thu, 10 Nov 2011 02:10:07 -0800	[thread overview]
Message-ID: <111110021007.ZM6786@torch.brasslantern.com> (raw)
In-Reply-To: <20111110071946.GA2380@devbox>

On Nov 10,  9:19am, Eugene Dzhurinsky wrote:
}
} Okay, I wrote stupid and simple program to de-duplicate lines in
} history file:

You can't compare that to what zsh is doing.  The history file isn't
just duplicate lines, it's duplicate shell parser constructs which
may span multiple lines.  The only way to _correctly_ deduplicate it
is to run it through the parser while loading it; that's where all
the time/CPU is going.

} Am I missing something there if would say that history saving and
} de-duplication is suboptimal?

If a special routine that does nothing but deduplicate the file were
to be added, it could probably be faster, yes.  The history mechanism
performs the deduplication by loading the file back in roughly as if
all the commands were being typed at the command line again, so that
the behavior of deduplication exactly reproduces what the shell would
have done interactively with all the setopts that are in effect.

This is simply not an operation that's done often enough -- nor is
having 10000+ lines of shared deduplicated history a common enough user
configuration -- for anyone to have undertaken to create an efficient
deduplication routine that nevertheless faithfully reproduces the
behavior of re-parsing the file.  Feel free to contribute that ...

However, it might be simpler just to unset the options that cause the
file to be deduped on shell exit, and e.g. allow it to be deduped on
shell startup instead.


  reply	other threads:[~2011-11-10 10:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-09 22:20 Eugene Dzhurinsky
2011-11-10  1:14 ` Rommel Martinez
2011-11-10  6:56   ` Eugene Dzhurinsky
2011-11-10  3:51 ` Bart Schaefer
2011-11-10  7:19   ` Eugene Dzhurinsky
2011-11-10 10:10     ` Bart Schaefer [this message]
2011-11-10 10:15       ` Eugene Dzhurinsky
2011-11-10 10:46         ` Bart Schaefer
2011-11-10 10:58           ` Eugene Dzhurinsky

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=111110021007.ZM6786@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).