ParkMyCar / compact_str

A memory efficient string type that can store up to 24* bytes on the stack
MIT License
653 stars 47 forks source link

from_utf8_lossy is 10x slower than std #406

Open turalcar opened 2 months ago

turalcar commented 2 months ago

For typical cases (small mostly ASCII strings) CompactString::from_utf8_lossy(s) is significantly (~10x) slower than CompactString::from(String::from_utf8_lossy(s))

ParkMyCar commented 2 months ago

Thanks for the reporting the issue! From what I remember the implementation was ported from the stdlib, although I don't think much time has been spent making sure it's as performant, I'll have to dive in here.