#integer #decimal #printing #format-string #write #performance #buffer

no-std itoap

Even faster functions for printing integers with decimal format

6 releases (1 stable)

1.0.1 Feb 18, 2021
0.1.5 Jan 29, 2021
0.1.2 Dec 31, 2020
0.1.1 Jul 24, 2020

#80 in Value formatting

Download history 15677/week @ 2024-07-20 17232/week @ 2024-07-27 18029/week @ 2024-08-03 15700/week @ 2024-08-10 14848/week @ 2024-08-17 15971/week @ 2024-08-24 17514/week @ 2024-08-31 16517/week @ 2024-09-07 14956/week @ 2024-09-14 18976/week @ 2024-09-21 17174/week @ 2024-09-28 17768/week @ 2024-10-05 20715/week @ 2024-10-12 23199/week @ 2024-10-19 18851/week @ 2024-10-26 16360/week @ 2024-11-02

81,792 downloads per month
Used in 129 crates (8 directly)

MIT license

84KB
666 lines

Welcome to itoap 👋

Version docs Tests codecov Rust 1.36 License: MIT

This crate provides even faster functions for printing integers with default format than itoa crate.

Comparison with itoa crate

If you want to write integers in decimal format to String, Vec or any other contiguous buffer, then this crate is the best choice.

If you want to write integers to a std::io::Write or std::fmt::Write, itoa crate and itoap crate shows almost same performance for some types, but itoap is generally faster.

The implementation is based on the sse2 algorithm from itoa-benchmark repository. While itoa crate writes integers from last digits, this algorithm writes from first digits. It allows integers to be written directly to the buffer. That's why itoap is faster than itoa.

Benchmark result

Benchmark program was executed under the following environment:

Hardware/Software Version
CPU model name Intel(R) Core(TM) i5-8265U CPU @ 1.60GHz
CPU micro architecture Sky Lake
Standard libc implementation glibc 2.31.0
rustc 1.51.0-nightly (368275062 2021-02-02)

Benchmark result

⚠️ performance of itoa crate highly depends on the CPU architecture and libc implementation.

Author

👤 Ryohei Machida

🤝 Contributing

Contributions, issues and feature requests are welcome!

Feel free to check issues page.

Show your support

Give a ⭐️ if this project helped you!

📝 License

Copyright © 2014-2016 Milo Yip, 2020 Ryohei Machida.

This project is MIT licensed.


This README was generated with ❤️ by readme-md-generator

No runtime deps