David Haller wrote:
Hello,
On Tue, 30 Oct 2018, Per Jessen wrote:
Anton Aylward wrote:
On 30/10/18 12:36 PM, Per Jessen wrote:
I was just wondering if e.g. 'find' or 'ls' had some options that would limit the scope ? (not mtime etc).
Well, I'd start with the "-f -- do not sort" option. Sorting means slurp up *everything* into memory, which is going to involve a lot of virtual memory work and probably paging to get there.
It's not memory that is the problem - the box has 64Gb. I tried 'ls -f', made no difference although I did not let it finish - the last 'find' ran for 14 hours before I had to stop it.
What you really want is "read one/print one" or "read one/process one"
Yep and that is more or less what the code does - do one getdents(), process it, rinse, repeat. With that I can list 3+ million files in minutes. It just seems to me 'ls' and 'find' ought to be able to do the same.
Weird. Both 'find' and 'ls' just do that (wrapped in a readdir(3) possibly).
Could you compare an
$ ltrace -S -efile ...
of ls/find vs. your "just getdents" code? A small sample dir (-tree) should suffice to spot the diff (when ls/find don't sort)...
Yep, that sounds interesting, I'll try that tomorrow.
Oh, well, yeah, ls _does_ need to stat if it's to print dates and stuff, so keep that in mind.
Good point. find will also need to, if I use -mtime (which I tend to do when tidying up old stuff). -- Per Jessen, Zürich (5.6°C) http://www.dns24.ch/ - your free DNS host, made in Switzerland. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org