Kixunil / fast_fmt

Faster, more flexible and more correct alternative to core::fmt
39 stars 3 forks source link

Needs benches #8

Open workingjubilee opened 4 years ago

workingjubilee commented 4 years ago

This crate features no benchmarks, yet claims to be "fast". Microbenchmarks may not be optimal, but it would be a start. They should also be set up to compare against core: after all, there's a race to win. :^)

sollyucko commented 4 years ago

There is one at https://github.com/Kixunil/fast_fmt/blob/master/src/lib.rs#L408-L435, with the results at https://github.com/Kixunil/fast_fmt#how-fast-is-it-in-practice.

workingjubilee commented 4 years ago

Needs more! ( actually surprised I missed that one given that I tried to scan the repository for such a thing, did I just go blind? )

But actually it really does need at least one more. An "interesting" thing about Rust's std is that right now, writing to a Vec often benches as significantly slower even though it is legal to use with write!, and it is of special interest given how many &[u8] buffers Rust features, especially if the goal is to optimize for embedded use (since you're more likely to write to a &[u8] slice than a Vec or String). Possibly due to a bulky write_fmt shim. So, at least that case needs benches.

Kixunil commented 4 years ago

Sure, would love to see more benchmarks. Unfortunately, I have different priorities these days, but definitely capable of merging PRs if you're interested.

There's also another crate with a similar goal that is a bit closer to std in its API, it's better developed but lacks some features (size hint, not generic over strategy). I don't remember the name, but the author is japaric, so you should be able to find it if it suits you better.