5 Commits
Author SHA1 Message Date
Mert e76d8cb0f1 feat: backpressure and fewer allocations (#29)
* tweaks

* reduce allocations

* backpressure
2026-02-18 09:45:44 +01:00
Jonathan Jogenfors fb6c91a870 feat: add ts benchmarks (#10)
feat: benchmarks
2026-02-16 22:40:45 +01:00
Thomas 5445b8ab1f feat: use async iterator (#6)
The async iterator API is quite ergonomic, and allows us to send paths
in batches. Sending paths in batches means that we can start processing
the paths before we've finished searching, and also makes passing
messages between rust and nodejs much faster.

I tried quite a few variants, like using a Buffer and manually
reconstructing strings, callbacks, etc.

The fastest way to pass data between rust and nodejs is by encoding /
decoding JSON. It's pretty unintuitive, but this is mainly because rust
and C++ (native JSON.parse) are way faster than constructing strings
manually with the v8 engine.

Both callbacks and iterators are quite fast, and have their own
trade-offs. The API for iterators is much more ergonomic however, so
that's what I pursued.

The performance improvement compared to the current implementation is
huge. Up to 2-3x in some cases.

	❯ hyperfine 'node example/old.ts' 'node example/stream.ts' 'node example/main.ts'
	Benchmark 1: node example/old.ts
	Time (mean ± σ):      2.007 s ±  0.478 s    [User: 2.572 s, System: 2.357 s]
	Range (min … max):    1.619 s …  3.326 s    10 runs

	Benchmark 2: node example/stream.ts
	Time (mean ± σ):      1.234 s ±  0.258 s    [User: 2.976 s, System: 2.811 s]
	Range (min … max):    0.913 s …  1.735 s    10 runs

	Benchmark 3: node example/main.ts
	Time (mean ± σ):      1.117 s ±  0.267 s    [User: 2.425 s, System: 2.484 s]
	Range (min … max):    0.809 s …  1.680 s    10 runs

	Summary
	node example/main.ts ran
		1.10 ± 0.35 times faster than node example/stream.ts
		1.80 ± 0.61 times faster than node example/old.ts
2026-02-15 21:36:19 +00:00
Jonathan Jogenfors 10f5e037f9 chore: napi-rs v3 (#8) 2026-02-15 12:01:30 -05:00
Jonathan Jogenfors f19b3a7e84 feat: initial implementation (#1)
feat: initial code
2026-02-13 19:14:26 -05:00