zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: zsh-workers@zsh.org
Subject: Re: [PATCH] readhistfile: avoid thousands of lseek(2) syscalls via ftell()
Date: Sat, 10 Apr 2021 02:54:51 +0200	[thread overview]
Message-ID: <91966-1618016091.272434@pUFi.MzyD.eXSj> (raw)
In-Reply-To: <CANnVG6mmK+i87hSu1KUxs9APyeXVHiwf1oZpokCgYSEu4UP_tQ@mail.gmail.com>

On 7 Feb 2020, Michael Stapelberg wrote:
> Before this change, zsh startup time was dominated by lseek(2) system calls on
> the history file, as shown by strace -c:

This patch never got applied. 45768 is almost identical.

I tried timing the readhistline function with dtrace on FreeBSD to see
if this is perhaps only relevant with glibc. It didn't appear to result
in particularly great savings however when measuring a few times, I did
consistently get better performance with the patch than without. That was
with a fast local disk and of the order of microseconds - certainly not
enough to be discernable. Over NFS, timings were erratic.

Having read through both patches, nothing caught my attention as being
a concern. 45396 keeps track of number of bytes read while 45768 does
the same with file position in an off_t variable. The first doesn't
duplicate a strlen() call which is preferable but the second patch could
be tweaked to do likewise. Does anyone have a preference between them?
If nobody else has any particular views on the patch(es), I'm inclined to
apply, probably the first one.

Oliver


  reply	other threads:[~2021-04-10  0:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-07  7:47 Michael Stapelberg
2020-02-07 11:30 ` Mikael Magnusson
2020-02-07 11:33   ` Michael Stapelberg
2021-04-10  0:54     ` Oliver Kiddle [this message]
2021-04-10 17:31       ` Bart Schaefer
2020-02-08  5:54 ` Bart Schaefer
2020-02-08  7:47   ` Michael Stapelberg

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=91966-1618016091.272434@pUFi.MzyD.eXSj \
    --to=okiddle@yahoo.co.uk \
    --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).