Skip to content

Even faster functions for printing integers with decimal format

License

Notifications You must be signed in to change notification settings

Kogia-sima/itoap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

81 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Welcome to itoap 👋

Version docs Tests codecov Rust 1.36 License: MIT

This crate offers even more rapid functions for formatting integers into decimal format compared to the itoa crate.

Comparison with itoa crate

If you desire to convert intergers into a decimal format and store them in a String, Vec or any other contiguous buffer, then this crate will be the best choice.

For writing integers to a std::io::Write or std::fmt::Write, both the itoa crate and the itoap crate shows nearly identical performance for certain types, although itoap is generally faster.

The underlying implementation is based on the sse2 algorithm from the itoa-benchmark repository. While the itoa crate processes integers from the last digits, this algorithm operates from first digits, enabling direct writing of integers to the buffer. Consequently, itoap outperforms itoa due to the efficiency.

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.35.0
rustc rustc 1.70.0-nightly (07e0e2ec2 2023-02-28)

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

About

Even faster functions for printing integers with decimal format

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages