4 ms·
Glob() is (iirc) not sorted in any way on macos. I would prefer alphanumerical sort by name as it is stable across OSs. Parallelization is optimization so I th
by pletnes 8y ago
Glob() is (iirc) not sorted in any way on macos. I would prefer alphanumerical sort by name as it is stable across OSs.
Parallelization is optimization so I think «make it right, then make it fast» is sound advice.
- avar 8y agoThe glob() function is sorted consistently on all platforms. It's mandated by POSIX[1], and from the OSX docs I could find[2] sorted unless you specify the POSIX GLOB_NOSORT flag, as on other platforms. In any case, even if glob() wasn't portable it's easy to provide an API compatibility layer that's just readdir() + qsort(). That part would be trivial, and might perhaps be needed due to collation issues in the sort. Doing it in parallel (preferably in a random order) isn't just an optimization, but would ensure that there isn't an implicit dependency on whatever iterative interface we'd first ship with. 1. http://pubs.opengroup.org/onlinepubs/009695299/functions/glob.html http://pubs.opengroup.org/onlinepubs/009695299/functions/glo... 2. https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man3/glob.3.html https://developer.apple.com/library/archive/documentation/Sy...