Decimal and and hexadecimal parsing of String inputs are based on quite different code shapes. However, the parsing proper is almost unaffected by the radix (10 and 16, resp.), and can be unified in a single parameterized algorithm.
Moreover, resource consumption (CPU and memory) during parsing can be considerably reduced when facing huge inputs (e.g., malicious inputs).
In fact, before the mathematical conversion itself, the proposed parsing does not instantiate objects at all, meaning that errors can be detected without heap allocations.
Further, the code has been extended for a future Float16 numerical type (IEEE 754-2019 binary16).
Finally, hexadecimal conversion can be achieved with less CPU and no memory consumption (except for one returned object).
Moreover, resource consumption (CPU and memory) during parsing can be considerably reduced when facing huge inputs (e.g., malicious inputs).
In fact, before the mathematical conversion itself, the proposed parsing does not instantiate objects at all, meaning that errors can be detected without heap allocations.
Further, the code has been extended for a future Float16 numerical type (IEEE 754-2019 binary16).
Finally, hexadecimal conversion can be achieved with less CPU and no memory consumption (except for one returned object).
- relates to
-
JDK-8345403 Add more randomized tests to better cover FloatingDecimal parsing
-
- Resolved
-
- links to
-
Review(master) openjdk/jdk/22737