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

perf: use a hashmap when possible for file extension matching #1421

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

5225225
Copy link

@5225225 5225225 commented Mar 16, 2025

This shouldn't affect behavior in any way, since glob patterns of the form *.foo / *.bar are disjoint, so it doesn't matter which order we search them in.

The exact order of disjoint patterns like that aren't preserved anymore, so the test suite needed to change a bit.

hyperfine "./target/release/eza --color=always /nix/store" on 3ad8132 gets

Benchmark 1: ./target/release/eza --color=always /nix/store
Time (mean ± σ): 5.109 s ± 0.488 s [User: 4.682 s, System: 0.383 s]
Range (min … max): 4.691 s … 6.262 s 10 runs

when on this branch (d2ff56b), it is

Benchmark 1: ./target/release/eza --color=always /nix/store
Time (mean ± σ): 724.7 ms ± 6.3 ms [User: 379.4 ms, System: 339.9 ms]
Range (min … max): 714.7 ms … 733.0 ms 10 runs

(and for reference: ls /nix/store | wc -l is 77967)

I didn't want to add any new dependencies, but Simple probably should be using a small string. This is definitely an improvement as-is though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🆕 New
Development

Successfully merging this pull request may close these issues.

1 participant