[Haskell-cafe] How to optimize a directory scanning?

Joachim Durchholz jo at durchholz.org
Sun May 12 06:27:01 UTC 2019


Am 12.05.19 um 00:23 schrieb KC:
> Are directories stored in consecutive disk blocks?

That's something that you have to rely on the file system to organize 
for you.
Brandon's answer is the traditional one for Unix filesystems, up to and 
including ext3fs. Modern filesystems try to do better (and often do), 
since scanning large directories has turned out to be so important.
If you do performance testing, both bad and good filesystem performance 
may be accidental; if you want to know not just the typical behaviour 
but also the pathological cases, you'll either have to wait for user 
reports to come in or talk to real filesystem experts (and even their 
answers will mostly be on an "it depends" basis).
Note that fragmentation is irrelevant for SSDs.

The OP is at the "what system calls are being done" stage; optimization 
questions about fragmentation aren't going to be relevant to him I think.

TL;DR: Don't worry about fragmentation, unless you are willing to spend 
a really high amount of time on detail optimization.

Regards,
Jo


More information about the Haskell-Cafe mailing list