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

Add CBORGenerat.Feature.WRITE_MINIMAL_DOUBLES for writing doubles as floats if safe to do so #356

Merged
merged 1 commit into from
Feb 10, 2023

Conversation

here-abarany
Copy link
Contributor

Enabling WRITE_MINIMAL_DOUBLES works similarly to WRITE_MINIMAL_INTS, choosing to use a smaller data representation (single-precision float) when the conversion will result in no loss of data. This can provide a substantial savings for data that contains many doubles that don't require full precision.

Cleaned up some of the writing code for floats and doubles to avoid code duplication, and reserve the proper amount of space for output for both types.

Enabling WRITE_MINIMAL_DOUBLES works similarly to WRITE_MINIMAL_INTS,
choosing to use a smaller data representation (single-precision float) when
the conversion will result in no loss of data. This can provide a
substantial savings for data that contains many doubles that don't require
full precision.

Cleaned up some of the writing code for floats and doubles to avoid code
duplication, and reserve the proper amount of space for output for both
types.
@here-abarany
Copy link
Contributor Author

@cowtowncoder Just wanted to make sure you saw this PR. It's a relatively small addition, especially compared to my previous submission.

@cowtowncoder
Copy link
Member

Excellent, @here-abarany -- sounds like useful feature, simple enough implementation. Could even consider possibility of porting to Smile format backend. But for now I'll merge it.

@cowtowncoder cowtowncoder merged commit 713a6ab into FasterXML:2.15 Feb 10, 2023
@cowtowncoder cowtowncoder changed the title Add WRITE_MINIMAL_DOUBLES feature to CBORGenerator Add CBORGenerat.Feature.WRITE_MINIMAL_DOUBLES for writing doubles as floats if safe to do so Feb 10, 2023
@cowtowncoder cowtowncoder added this to the 2.15.0 milestone Feb 10, 2023
cowtowncoder added a commit that referenced this pull request Feb 10, 2023
@cowtowncoder
Copy link
Member

Ok, merged in 2.15 then to master.

@here-abarany
Copy link
Contributor Author

Thanks!

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

Successfully merging this pull request may close these issues.

2 participants