Use Ryū's small feature to cut ~9kb #55
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The ryu crate is used by serde_json to format floats when JSON encoding and when printing floats on JSON parse errors. The
small
feature reduces its binary size (it embeds a smaller table) at the cost of some performance. This change makes it so the "small" feature is used for Functions using this crate, shaving ~9kb.Given dumping floats probably isn't the most frequent operation, and that the difference in performance is minimal (see below), this seems reasonable.
The caveat is that it doesn't look users can opt-in using the default features (i.e.
[]
) of ryu, or at least, I couldn't figure out how. If we think this is problematic, we could updatefunction-examples
'Cargo.toml
s to include the feature override.The benchmark