Rust Decimal Crates: Benchmarking Fixed vs. Arbitrary Precision
This review analyzes a benchmark comparison of rust_decimal, decimal, and bigdecimal crates, identifying performance trade-offs for Rust developers requiring precise decimal arithmetic. The Answer Up…
This review analyzes a benchmark comparison of
rust_decimal,decimal, andbigdecimalcrates, identifying performance trade-offs for Rust developers requiring precise decimal arithmetic.
The Answer Up Front
For most Rust applications requiring precise decimal arithmetic, particularly in financial or accounting contexts where fixed-point precision is sufficient and performance is critical, rust_decimal is the clear choice. Its i128-backed implementation delivers significantly faster operations for addition, multiplication, division, parsing, and formatting compared to arbitrary-precision alternatives. Developers needing arbitrary precision for extremely large or small numbers, where performance is a secondary concern, should consider decimal or bigdecimal, though they come with a substantial performance penalty. Skip bigdecimal if decimal meets your arbitrary precision needs, as bigdecimal generally performs worse.
Methodology
This v0 review draws on the founder Wubing Zheng's published claims and benchmarks at https://wubingzheng.github.io/en/Decimal-Crates-Comparison.html, accessed on 2026-06-15. Independent benchmarks are pending. Update cadence: re-tested when claims diverge from observed behavior. The review covers the performance comparison of three prominent Rust decimal crates: rust_decimal (version 1.35.0), decimal (version 2.0.0), and bigdecimal (version 0.4.1). The source signal details a benchmark suite designed to measure the execution speed of common arithmetic operations (addition, multiplication, division), parsing from strings, and formatting to strings. Benchmarks were conducted on a machine with an Intel i5-12400F CPU and 32GB RAM, using Rust 1.78.0. The methodology included criterion for benchmarking, ensuring statistical rigor for the reported numbers. What is not covered in this review includes long-term workflow integration, memory footprint analysis, edge-case handling beyond standard arithmetic, or independent performance verification by our team.
What It Does
The source provides a direct, data-driven comparison of three Rust crates for handling decimal numbers, a critical requirement for applications where floating-point inaccuracies are unacceptable. Each crate offers a distinct approach to decimal arithmetic.
rust_decimal: Fixed-point precision
This crate implements a fixed-point decimal type, backed by an i128 integer. It supports up to 38 digits of precision and is designed for performance in financial and accounting applications. The comparison highlights its speed advantage across most operations due to its fixed-size representation and optimized integer arithmetic.
decimal: Arbitrary precision with Rust-native big integers
This crate offers arbitrary-precision decimal numbers, meaning it can represent numbers with any number of digits before or after the decimal point, limited only by available memory. It achieves this by using its own internal big integer implementation. The benchmark shows it to be significantly slower than rust_decimal but faster than bigdecimal for arbitrary precision.
bigdecimal: Arbitrary precision with num_bigint
Similar to decimal, bigdecimal provides arbitrary-precision decimal numbers. However, it relies on the num_bigint crate for its underlying big integer operations. The comparison positions bigdecimal as the slowest of the three for the benchmarked operations, indicating a performance overhead associated with its num_bigint dependency.
What's Interesting / What's Not
The most interesting aspect of Wubing Zheng's comparison is the stark performance differential between fixed-point and arbitrary-precision decimal implementations in Rust. The founder reports rust_decimal is consistently orders of magnitude faster for common operations. For instance, addition and multiplication are measured in nanoseconds for rust_decimal, while decimal and bigdecimal often take hundreds of nanoseconds or even microseconds. Parsing and formatting also show similar gaps, with rust_decimal frequently completing tasks in tens of nanoseconds where the arbitrary-precision crates take hundreds or thousands. This quantitative difference provides clear guidance for developers prioritizing performance.
What is less surprising, but still valuable to confirm, is the expected trade-off: arbitrary precision comes at a significant performance cost. The benchmarks confirm that the flexibility of handling numbers of any scale necessitates more complex, and thus slower, underlying arithmetic. The specific finding that decimal generally outperforms bigdecimal for arbitrary precision is a useful detail, suggesting that decimal's custom big integer implementation might be more optimized for decimal operations than num_bigint's more general-purpose approach.
The comparison also implicitly highlights the maturity of the Rust ecosystem for numerical computing. Having multiple robust options, each with distinct performance profiles, allows developers to make informed choices based on their specific requirements rather than being forced into a single, suboptimal solution.
Pricing
All three crates (rust_decimal, decimal, bigdecimal) are open-source and available under permissive licenses (MIT for rust_decimal and decimal, Apache 2.0/MIT for bigdecimal). There are no associated costs or commercial tiers. Pricing snapshot date: 2026-06-15.
Verdict
For the vast majority of Rust applications requiring decimal arithmetic, particularly those in finance, e-commerce, or any domain where performance and predictable precision are paramount, rust_decimal is the recommended choice. Its fixed-point, i128-backed design delivers superior speed and efficiency. If your application genuinely requires arbitrary precision for numbers that exceed rust_decimal's 38-digit capacity, decimal is the better option among the arbitrary-precision crates, offering better performance than bigdecimal according to the benchmarks. The choice hinges on whether fixed or arbitrary precision is a hard requirement for your domain.
What We'd Test Next
Our next steps would involve independently reproducing Wubing Zheng's benchmarks to verify the reported performance numbers across different hardware architectures and Rust versions. We would also expand the test suite to include more complex financial calculations (e.g., interest compounding, currency conversions with rounding rules) and edge cases like division by zero or operations with extremely large/small arbitrary-precision numbers. Memory footprint analysis for each crate under varying load conditions would also be valuable, especially for long-running services. Finally, we would investigate the compile times and binary sizes introduced by each crate, as these can be significant factors for embedded or resource-constrained environments.
The investor read
The detailed benchmarking of Rust decimal crates signals a maturing ecosystem for high-performance, precision-critical applications. As Rust gains traction in fintech, blockchain, and scientific computing, the demand for robust numerical libraries will only grow. rust_decimal's performance advantage highlights the value of optimized fixed-point solutions for common use cases, potentially reducing operational costs for companies building on Rust. The existence of multiple arbitrary-precision options, despite their performance trade-offs, shows a commitment to comprehensive numerical capabilities. Investors should note that while these specific crates are open-source, the underlying need for such tooling drives demand for Rust expertise and potentially commercial support/consulting around these foundational libraries. This trend indicates a healthy, expanding market for Rust-based infrastructure.
Pull quote: “For most Rust applications requiring precise decimal arithmetic, particularly in financial or accounting contexts where fixed-point precision is sufficient and performance is critical, rust_decimal is the clear choice.”
Every claim ties to a primary source. See our methodology.