node-rs
node-rs copied to clipboard
Add @napi-rs/glob package
This is a very rough draft for adding a new package that wraps Rust's glob crate. I'm aiming to teach myself Rust and NAPI stuff by doing this. You don't have to review it right now but if you have any helpful comments I would greatly appreciate it!
Fixes: https://github.com/napi-rs/node-rs/issues/605
TODO
- [x] Benchmark
- [ ] Default export https://github.com/napi-rs/napi-rs/issues/1046
@Brooooooklyn thank you for your responses
Question: is there a way of making this async? In the Rust land it is a sync operation but it can take some time so it would be ideal to unlock the Node.JS event loop while doing work.
https://napi.rs/docs/concepts/async-task
@Brooooooklyn Added some bench and mine is slower! Any ideas where we can improve the performance on this?
"glob":
14 120 ops/s, ±1.43% | fastest
"@napi-rs/glob":
12 553 ops/s, ±0.19% | slowest, 11.1% slower
Note: this is for the sync operation. I'm still having bugs in the async version
Fixed the async API and benchmark code. Of course napi would be faster!