Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved Long-Double Number Policy #2674

Merged

Commits on May 9, 2024

  1. Improved Long-Double Number Policy

    The Parsing of a Double value was always executing a `Long.parseLong(value)`, which generated a `NumberFormatException`.
    
    Identifying that a Number is a Double or a Long can be easily achieve (in a naive way) looking for the decimal separator.
    
    This simple change avoids the extra `NumberFormatException`
    
    A simple JUnit test, parsing a `Long` or a `Double` 10K times shows the next values:
    
    * Double (old parsing): ~42 ms
    * Double (new parsing): ~6 ms
    * Long (old parsing): ~7 ms
    * Long (new parsing): ~7 ms
    
    As we can see, the parsing for `Long` values stays the same (±1ms), while the parsing for `Double` is dramatically improved.
    
    Reducing the number of exceptions also has a positive side effect in memory consumption.
    ctasada authored and Carlos Tasada committed May 9, 2024
    Configuration menu
    Copy the full SHA
    e175533 View commit details
    Browse the repository at this point in the history

Commits on May 13, 2024

  1. Replace contains(".") by indexOf('.') >= 0

    The usage of `indexOf(char)` is slightly faster
    ctasada authored and Carlos Tasada committed May 13, 2024
    Configuration menu
    Copy the full SHA
    aa2db76 View commit details
    Browse the repository at this point in the history

Commits on May 14, 2024

  1. Rename exception variables

    ctasada authored and Carlos Tasada committed May 14, 2024
    Configuration menu
    Copy the full SHA
    cf87bf0 View commit details
    Browse the repository at this point in the history