Closed rchillyard closed 3 years ago
There was indeed something wrong in the encoding. We were converting to double and then to long. But converting to double involved writing out the BigDecimal as a String and then parting that String as a double. Whoa!
Here is the comment from Line 3275 of java.math.BigDecimal.java: // Somewhat inefficient, but guaranteed to work.
Because there are sets of BigDecimal values that may not map well to the range of longs, we also now offer a scaledBigDecimalEncoder where you tell it the power of ten by which you want to increase (or decrease with negative) the size of the BigDecimal values before converting to long.
When we HuskySort BigDecimals, it takes much longer than the system sort. There must be something wrong in the encoding, I think, even though I have unit-tested it. I'd like to know why this is so slow.