paupino / rust-decimal

Decimal number implementation written in pure Rust suitable for financial and fixed-precision calculations.
https://docs.rs/rust_decimal/
MIT License
1.03k stars 183 forks source link

Macros: remove circular dependency from macros feature #644

Open paupino opened 9 months ago

paupino commented 9 months ago

This revisits the previous macro feature and removes the dependency on rust-decimal for parsing the string. Consequently, macros and rust decimal can be decoupled and delivered independently.

There may be a small regression in performance so I'm keeping this in draft as I diagnose.

New bench:

running 2 tests
test decimal_from_str            ... bench:          90 ns/iter (+/- 2)
test decimal_scientific_from_str ... bench:         265 ns/iter (+/- 8)

Old bench:

test decimal_from_str            ... bench:          69 ns/iter (+/- 1)
test decimal_scientific_from_str ... bench:         198 ns/iter (+/- 4)