/usr/bin/find vs RangedDirectoryIterator

Guys - we are just trying to optimise recursively indexing files, and I’ve noticed I can double the performance of findChildFiles recursive on the Mac by removing the check for isReadOnly and isHiddenFile. I.e. takes 35 seconds instead of around 80 seconds to index 250,000 files.

As these values aren’t important (I don’t think) for the returning an Array from findChildFiles maybe there’s room for some optimisation?

Still trying to work out how /usr/bin/find does it in 2 seconds :slight_smile:

1 Like

Well this runs 160x quicker :slight_smile:

#include <iostream>
#include <filesystem>

using recursive_directory_iterator = std::filesystem::recursive_directory_iterator;

int main()
	for (const auto& dirEntry : recursive_directory_iterator("/Users/jim/Samples/"))
		std::cout << dirEntry.path() << std::endl;

	return 0;

Wow, great find!

You’ll want this to support old macos targets - just checking it’s performance. As the native one requires a deployment target of 10.15.

1 Like

Interesting, thanks! I’m not yet selling to customers — do you still have a meaningful % on Mojave and below?

Musicians never upgrade!