Here are my results btw: (updated with the recent commits)
Benchmark 1: ListDir
Time (mean ± σ): 523.7 ms ± 32.6 ms [User: 1443.9 ms, System: 7177.9 ms]
Range (min … max): 479.2 ms … 570.0 ms 10 runs
Benchmark 2: fd -u
Time (mean ± σ): 479.5 ms ± 10.3 ms [User: 3610.1 ms, System: 4015.8 ms]
Range (min … max): 461.1 ms … 497.8 ms 10 runs
Summary
fd -u ran
1.09 ± 0.07 times faster than ListDir
Edit2: The immediate feedback from our guru, which is hard to disagree with, is that traversing a single relatively small directory tree is not a proper benchmark. So the title should be amended with “on my computer, in a single relatively small case”.
Maybe the lesson shouldn’t be that Haskell is “faster” but that we should just be impressed that well-written Haskell fed to GHC can produce such well-optimized programs at such a high level of abstraction
I mentioned this in a couple other places, but they are comparing against fd 8.7.1 which is before I optimized fd by 6-13x in version 9.0.0. They’re currently redoing the benchmark against the latest version of fd: https://x.com/hk_hooda/status/1885393060848161153
Speed is one thing but
fdwas showing 10× the RAM usageHere are my results btw: (updated with the recent commits)
Hey. What’s up with that. We can’t have another language be more Blazingly Fast! This needs to be fixed. :D
Edit: Created https://www.reddit.com/r/rust/comments/1iekv4t/blazingfast_directory_tree_traversal_haskell/
Edit2: The immediate feedback from our guru, which is hard to disagree with, is that traversing a single relatively small directory tree is not a proper benchmark. So the title should be amended with “on my computer, in a single relatively small case”.
Maybe the lesson shouldn’t be that Haskell is “faster” but that we should just be impressed that well-written Haskell fed to GHC can produce such well-optimized programs at such a high level of abstraction
Yes, I have to say the code is eminently readable, as someone who merely dabbled in Haskell, long ago.
I thought the gnarly code would be in the libraries, but that looked fine too (I didn’t read all of it.)
I wonder how they compare to LLFIO in C++, which beats other solutions I tried by, like, an order of magnitude
https://catalinpichiu.com/posts/cpp/fast-io/
https://github.com/ned14/llfio