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(dict)!: Switch to PHF Map #1198

Merged
merged 8 commits into from
Dec 31, 2024
Merged

perf(dict)!: Switch to PHF Map #1198

merged 8 commits into from
Dec 31, 2024

Conversation

epage
Copy link
Collaborator

@epage epage commented Dec 31, 2024

We originally switched in #295 and #302.

Not sure what I saw before but the compile times are the same (6s for cargo check) and performance is better.

     Running benches/benches/main.rs (/home/epage/src/personal/typos/target/release/deps/benches-e28eceac6af8ea2f)
Timer precision: 10 ns
benches              fastest       │ slowest       │ median        │ mean          │ samples │ iters
├─ hit                             │               │               │               │         │
│  ├─ cased_map                    │               │               │               │         │
│  │  ╰─ finallizes  34.88 ns      │ 3.64 µs       │ 36.88 ns      │ 73.13 ns      │ 100     │ 100
│  ├─ map                          │               │               │               │         │
│  │  ╰─ finallizes  38.88 ns      │ 3.81 µs       │ 40.88 ns      │ 79.74 ns      │ 100     │ 100
│  ├─ ordered_map                  │               │               │               │         │
│  │  ╰─ finallizes  149.8 ns      │ 23.36 µs      │ 160.8 ns      │ 393 ns        │ 100     │ 100
│  ╰─ trie                         │               │               │               │         │
│     ╰─ finallizes  69.88 ns      │ 6.509 µs      │ 71.88 ns      │ 137 ns        │ 100     │ 100
╰─ miss                            │               │               │               │         │
   ├─ cased_map                    │               │               │               │         │
   │  ╰─ finalizes   11.71 ns      │ 18.37 ns      │ 12.57 ns      │ 12.41 ns      │ 100     │ 12800
   ├─ map                          │               │               │               │         │
   │  ╰─ finalizes   17.58 ns      │ 36.55 ns      │ 17.76 ns      │ 18.38 ns      │ 100     │ 6400
   ├─ ordered_map                  │               │               │               │         │
   │  ╰─ finalizes   129.5 ns      │ 271.8 ns      │ 131.1 ns      │ 134.1 ns      │ 100     │ 800
   ╰─ trie                         │               │               │               │         │
      ╰─ finalizes   55.88 ns      │ 3.367 µs      │ 57.88 ns      │ 90.84 ns      │ 100     │ 100

cased_map is faster but I expect the compile times from generating 3x the code won't be worth it.

No benchmarks are available for cased_match because I gave up after 23 minutes of compiling the benches (without it, it takes 52s to compile the benches)

@coveralls
Copy link

Pull Request Test Coverage Report for Build 12554848493

Details

  • 8 of 173 (4.62%) changed or added relevant lines in 7 files are covered.
  • 15 unchanged lines in 4 files lost coverage.
  • Overall coverage decreased (-0.7%) to 20.665%

Changes Missing Coverage Covered Lines Changed/Added Lines %
crates/dictgen/src/gen.rs 0 1 0.0%
crates/dictgen/src/ordered_map.rs 5 14 35.71%
crates/dictgen/src/match.rs 0 17 0.0%
crates/dictgen/src/insensitive.rs 2 34 5.88%
crates/dictgen/src/map.rs 0 42 0.0%
crates/typos-dict/tests/codegen.rs 0 64 0.0%
Files with Coverage Reduction New Missed Lines %
crates/dictgen/src/trie.rs 1 14.89%
crates/dictgen/src/map.rs 2 5.0%
crates/dictgen/src/insensitive.rs 6 21.74%
crates/dictgen/src/ordered_map.rs 6 11.9%
Totals Coverage Status
Change from base Build 12551967891: -0.7%
Covered Lines: 553
Relevant Lines: 2676

💛 - Coveralls

@epage epage merged commit 44cf2f8 into crate-ci:master Dec 31, 2024
21 checks passed
@epage epage deleted the generic branch December 31, 2024 12:56
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.

2 participants