remove unnecessary allocations in float and int serialization via SerJson and SerRon - #151
Merged
Merged
Conversation
not-fl3
reviewed
Feb 16, 2026
| '\u{41}'..='\u{5A}' | ||
| | '\u{61}'..='\u{7A}' | ||
| | '\u{30}'..='\u{39}' | ||
| | '\u{2D}' |
Owner
There was a problem hiding this comment.
Whats up with this one? Is this removal intentional?
Contributor
Author
There was a problem hiding this comment.
Oh, clippy told me that the pattern is unreachable because it is covered in an earlier branch, so I just removed it:
warning: unreachable pattern
--> src/toml.rs:15:11
|
15 | | '\u{2D}'
| ^^^^^^^^ no value can reach this
...
590 | '-' => {
| --- matches all the relevant values
...
601 | ident_chars!() => return self.parse_ident(i, num),
| -------------- in this macro invocation
Contributor
Author
There was a problem hiding this comment.
@not-fl3 Would it be possible for you to merge this MR already?
not-fl3
approved these changes
Feb 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
It is quite wasteful to allocate a new string for every integer or float encountered during serialization to json (or Ron) via e.g.
format!("{self:?}").I replaced all relevant instances by
write!(s.out, "{self:?}"), which formats into the output string directly without any transient allocation. If there were any benchmarks I am pretty sure we'd see performance improvements.