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

Replace slow JDK Double parsing with Daniel Lemire's fast_float algorithm #2686

Open
stefanthaler opened this issue May 24, 2024 · 2 comments
Labels

Comments

@stefanthaler
Copy link

What is your use-case and why do you need this feature?

I need to serialize objects with many Doubles in them. The JDK's default Double serialization is slow, particularly on Android phones.

I can use custom serializers of course, but I would rather have a fast default implementation.

Describe the solution you'd like

Use Daniel Lemire's fast_float algorithm for parsing Double instead of the JDK's default. The speedup is considerable, almost 4x on Android for my quick checks.

@sandwwraith
Copy link
Member

Is it a drop-in replacement though? We can't swap one implementation for another unless it always gives the same result, and IIRC, java.lang.Double.valueOf support various input formats, such as hexadecimal.

@qwwdfsad
Copy link
Collaborator

I think the most impactful thing would be to adopt it in the downstream toolchain itself instead.

The problem with changing such an intricate thing as Java's Double parser is that it might introduce quite subtle inconsistencies across the systems; also, for the sake of some (yet to be defined) performance gain, we'll have to (potentially significantly) compromise binary size and, potentially, some other performance characteristics

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants