Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: use ignore crate for matching gitignore patterns #341

Merged
merged 4 commits into from
Jun 12, 2024

Conversation

beeb
Copy link
Contributor

@beeb beeb commented Jun 11, 2024

Closes #337 and #2

The benchmark comparing ambs 0.6 with this branch:

$ hyperfine --warmup 3 "./target/release/ambs EXPORT_SYMBOL_GPL ./data/linux" "ambs EXPORT_SYMBOL_GPL ./data/linux"
Benchmark 1: ./target/release/ambs EXPORT_SYMBOL_GPL ./data/linux
  Time (mean ± σ):      1.217 s ±  0.046 s    [User: 2.356 s, System: 2.507 s]
  Range (min … max):    1.173 s …  1.309 s    10 runs

Benchmark 2: ambs EXPORT_SYMBOL_GPL ./data/linux
  Time (mean ± σ):      1.191 s ±  0.040 s    [User: 2.283 s, System: 2.529 s]
  Range (min … max):    1.131 s …  1.242 s    10 runs

Summary
  ambs EXPORT_SYMBOL_GPL ./data/linux ran
    1.02 ± 0.05 times faster than ./target/release/ambs EXPORT_SYMBOL_GPL ./data/linux

$ hyperfine --warmup 3 "./target/release/ambs irq_bypass_register_producer ./data/linux" "ambs irq_bypass_register_producer ./data/linux"
Benchmark 1: ./target/release/ambs irq_bypass_register_producer ./data/linux
  Time (mean ± σ):      1.209 s ±  0.023 s    [User: 2.220 s, System: 2.499 s]
  Range (min … max):    1.167 s …  1.256 s    10 runs

Benchmark 2: ambs irq_bypass_register_producer ./data/linux
  Time (mean ± σ):      1.177 s ±  0.016 s    [User: 2.123 s, System: 2.525 s]
  Range (min … max):    1.157 s …  1.214 s    10 runs

Summary
  ambs irq_bypass_register_producer ./data/linux ran
    1.03 ± 0.02 times faster than ./target/release/ambs irq_bypass_register_producer ./data/linux

I think it's a reasonable regression in performance considering the new implementation respects the full scope of gitignore syntax.

The ignore crate also provides Walk which can perform the task of traversing the file tree while respecting the gitignores. It is based on walkdir internally. That might provide additional performance benefits if implemented in the future.

@beeb beeb mentioned this pull request Jun 11, 2024
@beeb beeb changed the title refactor: use ignore crate for matching gitignore files refactor: use ignore crate for matching gitignore patterns Jun 12, 2024
@beeb beeb marked this pull request as ready for review June 12, 2024 05:34
@dalance
Copy link
Owner

dalance commented Jun 12, 2024

Thank you for your contribution!
I agree the performance regression is reasonable.
I'll merge this PR.

@dalance dalance merged commit 1e9f9fd into dalance:master Jun 12, 2024
4 checks passed
@beeb beeb deleted the ignore-crate branch June 12, 2024 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider using ignore crate
2 participants