News for hackers. Stuff that matters.
Re:Show HN: Fdir – Faster Node.js glob alternative by thecodrr on Sunday March 29, 2020 @09:45PM (#22724486)
How so? You can easily extend the searchFn to do the glob matching of files for you. I wanted to keep it dependency free. So I fail to see how fdir has "absolutely nothing to do with globbing"? Care to explain?
Re:Show HN: Fdir – Faster Node.js glob alternative by lhorie on Sunday March 29, 2020 @09:53PM (#22724517)
Not parent, but I think their argument is that this lib doesn't implement a glob interface so calling it a glob alternative is misleading, i.e. one cannot easily replace a globbing library with this if they expose the glob DSL as an interface. It's more accurate to say that your lib is a recursive-readdir alternative.
Re:Show HN: Fdir – Faster Node.js glob alternative by thecodrr on Sunday March 29, 2020 @10:11PM (#22724584)
In that case, fair enough. But no reason to be dishearted, we can always make "fdir-glob" that has globbing built in :D but you are right, not an easy* alternative but still an alternative.
Re:Show HN: Fdir – Faster Node.js glob alternative by tastroder on Monday March 30, 2020 @01:51AM (#22725576)
Would you mind changing the submission title? Your library simply does not glob (that's a word with fixed meaning), which is likely a rather expensive part of the hot path for real use cases.

Aside: Looking at the hyperfine results below, have you benchmarked this JS optimization vs. implementing it in C++ instead and consuming the results of that?

Re:Show HN: Fdir – Faster Node.js glob alternative by thecodrr on Monday March 30, 2020 @02:52AM (#22725793)
Hey, thanks for the interest. No, I cannot change the title because I don't have editing capabilities anymore.

I don't see the point of implementing it in c++ simply because I wanted to keep it simple, dependency free and easy to maintain. The fact that I know very little C++ also influenced that decision. Moreover, I am sure that way would be faster (from my understanding).

Re:Show HN: Fdir – Faster Node.js glob alternative by tastroder on Monday March 30, 2020 @05:19AM (#22726382)
The upside would be that you can specifically control when to pass values between the underlying C++ and the v8 runtime.

But anyway, this implementation is quite nice. I tried to recreate a more meaningful benchmark between a few of the libraries you compared with but on a real file system structure rrdir and node-walk just noped out by exceeding the maximum call stack size. Increasing that yielded pretty much the same results as your library for rrfind in the sync setting with the overhead likely being down to that one returning an object (mean difference between 50-100ms higher on ~1.1 million files).

Re:Show HN: Fdir – Faster Node.js glob alternative by thecodrr on Monday March 30, 2020 @05:48AM (#22726490)
You give a very valid reason to tryout an implementation in C++. I will definitely look into it. Thanks.

Would love to see the benchmark results! Do share a link if you can.

Thanks for auditing and taking the interest!