On Tue, 14 Feb 2023 08:02:08 GMT, Andriy Plokhotnyuk <d...@openjdk.org> wrote:
>> A reimplementation of `BigDecimal.[double|float]Value()` to enhance >> performance, avoiding an intermediate string and its subsequent parsing on >> the slow path. > > Sorry, I overlooked those checks two times :) > > How about adding a moderate path like > [this](https://github.com/plokhotnyuk/jsoniter-scala/blob/6f702ce5cae05df91b5aa6e4bd61acdf43bf18f6/jsoniter-scala-core/jvm/src/main/scala/com/github/plokhotnyuk/jsoniter_scala/core/JsonReader.scala#L1467-L1498)? > > I think it worth do be reused for regular parsing of `double` and `float` > values from `String`. @plokhotnyuk The main goal of this PR is to avoid generating a string and parse it, as it happens in the current implementation. The fact that it results in being faster is only a welcome byproduct. The proposed patch for `doubleValue()` is only about 40 lines of code, not counting `}`-only lines and the _extensive comments_ explaining the details for the benefit of both reviewers and maintainers. Shorter, documented code has a higher chance to be correct and understood. It also contributes to simpler and quicker reviewing. Adding the "moderate path" to this patch would increase the code size considerably. Moreover, I would have to invest time to understand the dense, uncommented code and convince myself and the reviewers that it is correct. I would also have to setup benchmarks to measure the overall benefits of adding it to the proposed patch. And add specific tests to cover the path. Before that, I would prefer for this patch to be first reviewed as it is (with possible corrections). I hope to have time to invest into your proposals _once_ this PR is integrated into mainline. Thanks for your patience. ------------- PR: https://git.openjdk.org/jdk/pull/9410