You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We're revisiting potential use of this library for https://github.com/cockroachdb/cockroach. https://github.com/cockroachdb/apd has served our needs well so far, but we're taking another look here because of performance. apd.Decimal always uses an "inflated" representation, which is good for code simplicity, but not for performance. Now that this library is tested against GDA (#117), we'd like to reconsider using it for the improved performance offered by the decimal.Bigcompact representation.
One difficulty (that I think was raised long ago, back in 2016) is that we rely on retrieving the mantissa of a decimal in order to encode it on disk. I'm not sure how to retrieve the mantissa of a decimal.Big when its either in compact or inflated form.
Would you be able to offer some advice, please? Perhaps this is a simple question - I'm by no means an expert on decimal representation.
Here's the exponent/mantissa retrieval code that we'd need to implement against decimal.Big, for reference:
Thanks. After spending time playing with the code, I now understand something I didn't before, which is that the compact and inflated representations are both "just" the mantissa, without any special encoding. I think the Raw access method is perfectly fine for our use case, so I'll just close this.
Hi,
We're revisiting potential use of this library for https://github.com/cockroachdb/cockroach. https://github.com/cockroachdb/apd has served our needs well so far, but we're taking another look here because of performance.
apd.Decimal
always uses an "inflated" representation, which is good for code simplicity, but not for performance. Now that this library is tested against GDA (#117), we'd like to reconsider using it for the improved performance offered by thedecimal.Big
compact
representation.One difficulty (that I think was raised long ago, back in 2016) is that we rely on retrieving the mantissa of a decimal in order to encode it on disk. I'm not sure how to retrieve the mantissa of a
decimal.Big
when its either in compact or inflated form.Would you be able to offer some advice, please? Perhaps this is a simple question - I'm by no means an expert on decimal representation.
Here's the exponent/mantissa retrieval code that we'd need to implement against
decimal.Big
, for reference:https://github.com/cockroachdb/cockroach/blob/master/pkg/util/encoding/decimal.go#L96-L148
The text was updated successfully, but these errors were encountered: