The conversion to and from string for arithmetic operations between Money and Decimal are unnecessary and expensive:
test money::tests::bench_decimal_direct ... bench: 3 ns/iter (+/- 0)
test money::tests::bench_decimal_from_string ... bench: 34 ns/iter (+/- 0)
I am proposing to implement the specializations for Decimal directly.
This PR also removes invalid arithmetic operations such as scalar divided by Money as we don't have reciprocal currency and adds Money / Money = Decimal.
The conversion to and from string for arithmetic operations between
Money
andDecimal
are unnecessary and expensive:I am proposing to implement the specializations for
Decimal
directly.This PR also removes invalid arithmetic operations such as scalar divided by
Money
as we don't have reciprocal currency and addsMoney / Money = Decimal
.