Merged
Conversation
Member
michaelkirk
commented
May 1, 2024
- attempt to make bench more deterministic
- [perf] mutate rather than allocate a bunch of heap strings
Open
4014433 to
3e2dd5c
Compare
michaelkirk
commented
May 1, 2024
| if (current - previous) < 0 { | ||
| coordinate = !coordinate; | ||
| } | ||
| let mut output: String = "".to_string(); |
Member
Author
There was a problem hiding this comment.
This allocation goes away
michaelkirk
commented
May 1, 2024
| @@ -62,7 +61,7 @@ fn encode(current: f64, previous: f64, factor: i32) -> Result<String, String> { | |||
| } | |||
| let from_char = char::from_u32((coordinate + 63) as u32).ok_or("Couldn't convert character")?; | |||
| output.push(from_char); | |||
Member
Author
There was a problem hiding this comment.
And we now just push directly onto the passed in string. Saving an allocation and a concatenation.
Member
Author
|
blech, sorry, I missed #40. Let me look at that first. |
Contributor
urschrei
approved these changes
May 6, 2024
Mostly the issue is with "bench HUGE polyline6 decoding". I'm not sure why. Interestingly this "HUGE" polyine is not much bigger than the other decode test, which seems to run in much more consistent time.
Bench output:
encode 10_000 coordinates at precision 1e-5
time: [123.68 µs 123.80 µs 123.94 µs]
change: [-74.528% -74.461% -74.401%] (p = 0.00 < 0.05)
Performance has improved.
Found 6 outliers among 100 measurements (6.00%)
4 (4.00%) high mild
2 (2.00%) high severe
encode 10_000 coordinates at precision 1e-6
time: [136.60 µs 137.55 µs 138.55 µs]
change: [-73.205% -73.066% -72.932%] (p = 0.00 < 0.05)
Performance has improved.
Found 11 outliers among 100 measurements (11.00%)
9 (9.00%) high mild
2 (2.00%) high severe
3e2dd5c to
db9b5b9
Compare
This was referenced May 13, 2024
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.