greyblake / whatlang-rs

Natural language detection library for Rust. Try demo online: https://whatlang.org/
https://whatlang.org/
MIT License
969 stars 109 forks source link

`raw_detect` perf tweaks #137

Closed jqnatividad closed 8 months ago

jqnatividad commented 1 year ago

Before:

running 4 tests
test bench_alphabet_cyrillic_calculate_scores ... bench:       1,923 ns/iter (+/- 60)
test bench_alphabet_latin_calculate_scores    ... bench:       2,706 ns/iter (+/- 151)
test bench_detect                             ... bench:   4,219,612 ns/iter (+/- 129,220)
test bench_detect_script                      ... bench:      73,365 ns/iter (+/- 3,556)

After tweaks:

running 4 tests
test bench_alphabet_cyrillic_calculate_scores ... bench:       1,917 ns/iter (+/- 68)
test bench_alphabet_latin_calculate_scores    ... bench:       2,748 ns/iter (+/- 98)
test bench_detect                             ... bench:   4,188,685 ns/iter (+/- 157,631)
test bench_detect_script                      ... bench:      69,409 ns/iter (+/- 4,946)
greyblake commented 8 months ago

Thank you! Sorry for the delay.