[
https://issues.apache.org/jira/browse/OAK-10972?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Nuno Santos resolved OAK-10972.
-------------------------------
Fix Version/s: 1.68.0
Resolution: Done
> JsonDeserializer: do not rely on NumberFormatExceptions in the common case
> when parsing doubles
> -----------------------------------------------------------------------------------------------
>
> Key: OAK-10972
> URL: https://issues.apache.org/jira/browse/OAK-10972
> Project: Jackrabbit Oak
> Issue Type: Improvement
> Components: documentmk, store-spi
> Reporter: Nuno Santos
> Priority: Minor
> Fix For: 1.68.0
>
>
> The current logic first tries to parse numbers as Long, catching a
> NumberFormatException if that fails and then parsing them as double.
> {code}
> try {
> type = PropertyType.LONG;
> values.add(Long.parseLong(number));
> } catch (NumberFormatException e) {
> type = PropertyType.DOUBLE;
> values.add(Double.parseDouble(number));
> }
> {code}
> This is very expensive because creating an exception requires capturing the
> stack trace. In a benchmark that iterates over 10 million json strings
> representing the contents of a typical Oak repository, an alternative
> implementation that does not rely on exceptions is almost 30% faster:
> - current logic: 70s
> - parser without exceptions: 50s
--
This message was sent by Atlassian Jira
(v8.20.10#820010)