RFR: 8341470: BigDecimal.stripTrailingZeros() optimization [v12]
Raffaello Giulietti
rgiulietti at openjdk.org
Fri Oct 4 17:50:34 UTC 2024
On Fri, 4 Oct 2024 17:22:32 GMT, fabioromano1 <duke at openjdk.org> wrote:
>> The real problem here is the maximal size this table can reach and the time it takes to be filled in the worst case: around 300 MB and several minutes.
>
> @rgiulietti Which means, however, wanting to work with a precision of billions of decimal digits, and therefore taking on the consequences...
It takes around 100 ms and less than 1 MB to build a table up to 20 rather than 29.
It can be fully constructed in `static { ... }`, avoiding races.
IMO, this would cover the vast majority of the cases encountered in practice.
Other, way less common usages with multi-millions or billions of digits would then impact running time but not _persistent_ memory footprint.
WDYT?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/21323#discussion_r1788083966
More information about the core-libs-dev
mailing list