Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH] readhistfile: avoid thousands of lseek(2) syscalls via ftell()



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




Messages sorted by: Reverse Date, Date, Thread, Author