whatisinternet / Inflector

A rust inflection library
https://docs.rs/Inflector
BSD 2-Clause "Simplified" License
126 stars 28 forks source link

Title case performance #30

Closed whatisinternet closed 8 years ago

whatisinternet commented 8 years ago

It's actually pretty good but much slower than it needs to be:

test cases::titlecase::tests::bench_is_title                    ... bench:         888 ns/iter (+/- 191)
test cases::titlecase::tests::bench_title                       ... bench:         804 ns/iter (+/- 188)
test cases::titlecase::tests::bench_title_from_snake            ... bench:         825 ns/iter (+/- 419)

A general approach might be to look at what PascalCase is doing and adapt it for Title Case since they're so similar.

whatisinternet commented 8 years ago

This is going to be part of 0.5.0 and thus I'm taking it for now