Done, thanks. On Fri, Feb 7, 2020 at 12:30 PM Mikael Magnusson wrote: > > On 2/7/20, Michael Stapelberg wrote: > > [please cc me in replies, as I’m not subscribed to this list] > > > > Before this change, zsh startup time was dominated by lseek(2) system calls > > on > > the history file, as shown by strace -c: > > > > time seconds usecs/call calls errors syscall > > ------ ----------- ----------- --------- --------- ---------------- > > 97,35 1,112890 1 697153 1 lseek > > 0,99 0,011314 2 5277 read > > […] > > > > This change keeps track of read bytes and the position within the file, > > removing > > all of these system calls. > > > > I verified correctness of the change by comparing fpos with ftell(in) in > > every > > loop iteration. > > > + *readbytes += strlen(buf + start); > > int len = start + strlen(buf + start); > > int len = strlen(buf + start); > *readbytes += len; > len += start; > > Even if you're convinced the compiler will optimize the double strlen > calls, the declaration has to come before code (I don't think we > require new enough C to not require this yet?). > > -- > Mikael Magnusson