Get the latest tech news

Optimizing My Disk Usage Program


Increasing performance by reducing thread scheduling overhead and lock contention.

I also tested with some hash functions that avalanche sequential integers but the results were comparable to my original idea with just the modulo. APFS hands out IDs sequentially so the bottom bits toggle fastest, causing threads that are scanning directory trees in creation order to pile into the same shard when using inode % 128. This improves temporal locality and cuts down inter-shard contention in our multithreaded crawl even though the statistical distribution stays perfectly flat across the whole disk.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of Disk Usage Program

Disk Usage Program