[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: merge pick and scan
From: |
Ken Hornstein |
Subject: |
Re: merge pick and scan |
Date: |
Thu, 21 Apr 2022 22:12:17 -0400 |
>> You see, nmh's dirty secret (ok ok, one of many!) is that the
>> first thing every command does is read the entire directory.
>> Yep, the whole thing.
>
>If you use any syscall tracer, you will see that this is not what
>happens. scan & pick will do a directory read only if no messages
>are specified because the default is all. Otherwise they only touch
>specified messages.
You are incorrect.
% strace scan 5705
[...]
chdir("/users/kenh/Mail/inbox") = 0
openat(AT_FDCWD, "/users/kenh/Mail/inbox", O_RDONLY|O_NONBLOCK|O_CLOEXEC
|O_DIRECTORY) = 3
access("/users/kenh/Mail/inbox", W_OK) = 0
getdents(3, /* 1365 entries */, 32768) = 32768
getdents(3, /* 1365 entries */, 32768) = 32760
getdents(3, /* 829 entries */, 32768) = 19912
getdents(3, /* 0 entries */, 32768) = 0
close(3) = 0
[...]
Anything that needs a "struct msgs" for a folder has to call
folder_read() (which is almost all nmh programs) and folder_read()
calls readdir() on the whole folder.
(I've got more to say about the original proposal, but ... tomorrow).
--Ken