Ryu Implementation for Float-to-string Conversion#1078
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1078 +/- ##
============================================
+ Coverage 67.23% 67.71% +0.48%
- Complexity 5484 5603 +119
============================================
Files 159 162 +3
Lines 23025 23387 +362
Branches 4126 4218 +92
============================================
+ Hits 15481 15837 +356
+ Misses 6262 6247 -15
- Partials 1282 1303 +21 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
tgregg
left a comment
There was a problem hiding this comment.
Here's something to try.
Since we'd be copying in the code with attribution instead of taking a dependency, we can modify the algorithm slightly to fit our needs.
You could try modifying the algorithm to output text Ion floats natively without the post-processing steps here: https://github.com/amazon-ion/ion-java/pull/1078/files#diff-b3377504685a7b6e1dddbc955be3d9c24e4f2e57e2e26a705c2733d2e5d88dabR844-R856
Maybe that would enable additional performance benefits.
|
Implement Schubfach instead |
Overview
This PR adds an implementation of the Ryu algorithm for efficient and accurate float-to-string conversion in ion-java. The Ryu algorithm provides performance improvements over traditional approaches while maintaining correctness.
Changes
RyuDouble.javawhich implements the core Ryu algorithm for double valuesRoundingMode.javato support different rounding strategiesBenefits
Double.toString()method in JDK 21References
License
The implementation maintains the original Apache 2.0 license from Ulf Adams' reference implementation.