Crates.io | fast_fmt |
lib.rs | fast_fmt |
version | 0.1.3 |
source | src |
created_at | 2017-05-29 19:25:18.877697 |
updated_at | 2017-07-02 18:52:48.65711 |
description | This crate provides faster, more flexible and more correct alternative to core::fmt |
homepage | https://github.com/Kixunil/fast_fmt |
repository | https://github.com/Kixunil/fast_fmt |
max_upload_size | |
id | 16809 |
size | 22,408 |
Faster, more flexible and more correct alternative to core::fmt
(AKA std::fmt
)
This is WIP. Some APIs may change, some may lack documentation, others may be broken. Information in this README (especially benchmarks) may be misleading. Contributions are highly appreciated!
I don't promise to work on this much for a while!
size_hint
allows writers to e.g. pre-allocate large enough buffer.Write
allows to optimize-out error checks.Instead of multiple traits like Display
, Debug
, ... this crate defines single Fmt<S>
which allows you to implement multiple different strategies, even your own. One possible use case is to implement Fmt<Localizer>
to enable localization of your application.
Instead of returning Err(())
on failed writes it returns apropriate types. It can even be Void
to represent writers that can never fail (e.g. std::string::String
).
The crate provides a very simple benchmark:
test bench::bench_core_fmt ... bench: 122 ns/iter (+/- 24)
test bench::bench_fast_fmt ... bench: 26 ns/iter (+/- 1)
It's consistently more than four times faster!
Roughly sorted by priority.
core
does.Fmt
for primitives)core::fmt
T: Iterator<char> + Clone
?genio
and provide encoders for different encodings.core
core::fmt
Last two are jokes.