4 ms·
ls -f
by osswid 5y ago
ls -f
- wolfgang42 5y ago-f do not sort, enable -aU, disable -ls --color -a do not ignore entries starting with . -U do not sort; list entries in directory order -l use a long listing format -s print the allocated size of each file, in blocks --color colorize the output I assume you mean to imply that by turning off sorting/filtering/formatting ls will run in a more optimized mode where it can avoid buffering and just dump the dentries as described in the article?
- jjgreen 5y agoSeems that way: https://github.com/wertarbyte/coreutils/blob/master/src/ls.c#L2538 https://github.com/wertarbyte/coreutils/blob/master/src/ls.c...
- loeg 5y agoYeah, exactly. OP is changing 3 variables and concluding that getdirent buffer size was the significant one, but actually the problem was likely (1) stat calls, for --color, and (2) buffer and sort, which adds O(N log N) sorting time to the total run+print time. (Both of which are avoided by using getdirent directly.)