fix: `jv_number_value` should cache the double value of literal numbers (#3245)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
The code of `jv_number_value` is intended to cache the double value of literal numbers, but it does not work because it accepts the `jv` struct by value. This patch fixes the behavior by checking if the double value is `NaN`, which indicates the unconverted value. This patch improves the performance of major use cases; e.g. `range(1000000)` runs 25% faster.
authored by itchyny · committed by GitHub · parent 64bd8ba · Browse files · 1 file+7 added−7 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
1 file+7 added−7 removed
- other:+7 added−7 removed