-
-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Big Decimal Support #73
Comments
Big decimals allocate memory on instantiation, which goes against the spirit of a fast serialization system. The worst part is that almost none of the implementations allow you to specify the backing array. Big decimals have their use of course. I am simply not sure what to do here. |
Hi! and thanks! Big decimals colfer encoding is just a length and a []byte in golang.
I'll try mirror the code used in "colf_binary" type for bigdecimal. in this time I'll create a branch 'bigdecimal" in the my forks area. ps.1: I Liked very very very much the code you made, it is a pleasant surprise to see a practical use of go / {ast, parser, etc.} []'s Gratitude, |
Thanks Dany. It is nice to hear you like you like the code. 😊 MarshalText allocates a new byte array. That's a big no-go in terms of performance. The generated code does not have any dependencies as a rule. That means we must either use whatever is in the core library, or expose the value in some sort of raw format. |
Hi! Mostly arbitrary precision libs already use a text or a array of bytes as mantissa, because this, mostly change or conversion (type to []byte and []byte to type) is high performance. i finished golang, so what next language do you want? |
A good start would be to add a big decimal entry in |
You are still allocating a new buffer with MarshalText. At least use Append with hex then for somewhat reasonable performance. Better would be to store the decimal point as a varint, and the integer representation as a big-endian byte array + sign bit. |
Hi! Thanks for this excelent serializer!
Please add suport for big.Int and decimal.Big !
My main need is the following golang types
(biginteger,native) math/big.Int and (bigdecimal) github.com/ericlagergren/decimal.Big
for others langs I don't care, but I would suggest:
java => (biginteger, native) https://docs.oracle.com/javase/10/docs/api/java/math/BigInteger.html
(bigdecimal, native) https://docs.oracle.com/javase/10/docs/api/java/math/BigDecimal.html
JavaScrip => (biginteger, native) https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt
(or, biginteger) https://github.com/MikeMcl/decimal.js
(bigdecimal) https://github.com/MikeMcl/decimal.js
C => (biginteger) https://github.com/libtom/libtommath
(bigdecimal) https://github.com/libtom/libtomfloat
Thanks Very Very Very Much!
Best Whishes,
Dani.
The text was updated successfully, but these errors were encountered: