-
Notifications
You must be signed in to change notification settings - Fork 12.1k
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
Micro-optimize vec.with_c_str for short vectors #9352
Merged
Merged
Commits on Sep 27, 2013
-
Configuration menu - View commit details
-
Copy full SHA for 4834661 - Browse repository at this point
Copy the full SHA 4834661View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0bdc99d - Browse repository at this point
Copy the full SHA 0bdc99dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 2a9e763 - Browse repository at this point
Copy the full SHA 2a9e763View commit details -
Configuration menu - View commit details
-
Copy full SHA for 410a96c - Browse repository at this point
Copy the full SHA 410a96cView commit details -
std: Micro-optimize vec.with_c_str for short vectors
This now makes it unsafe to save the pointer returned by .with_c_str as that pointer now may be pointing at a stack allocated array. I arbitrarily chose 32 bytes as the length of the stack vector, and so it might not be the most optimal size. before: test c_str::bench::bench_with_c_str_long ... bench: 539 ns/iter (+/- 91) test c_str::bench::bench_with_c_str_medium ... bench: 97 ns/iter (+/- 2) test c_str::bench::bench_with_c_str_short ... bench: 70 ns/iter (+/- 5) after: test c_str::bench::bench_with_c_str_long ... bench: 542 ns/iter (+/- 13) test c_str::bench::bench_with_c_str_medium ... bench: 53 ns/iter (+/- 6) test c_str::bench::bench_with_c_str_short ... bench: 19 ns/iter (+/- 0)
Configuration menu - View commit details
-
Copy full SHA for e02d1eb - Browse repository at this point
Copy the full SHA e02d1ebView commit details -
std: Remove an unnecessary comment from c_str
The documentation for `.with_c_str()` already says that the pointer will be deallocated before returning from the function.
Configuration menu - View commit details
-
Copy full SHA for ca66b81 - Browse repository at this point
Copy the full SHA ca66b81View commit details -
std: Up vec.with_c_str's stack buffer to 128
This matches @graydon's recommendation.
Configuration menu - View commit details
-
Copy full SHA for 4868273 - Browse repository at this point
Copy the full SHA 4868273View commit details -
std: add micro optimization to vec.with_c_str_unchecked
before: test c_str::bench::bench_with_c_str_unchecked_long ... bench: 361 ns/iter (+/- 9) test c_str::bench::bench_with_c_str_unchecked_medium ... bench: 75 ns/iter (+/- 2) test c_str::bench::bench_with_c_str_unchecked_short ... bench: 60 ns/iter (+/- 9) after: test c_str::bench::bench_with_c_str_unchecked_long ... bench: 362 ns/iter (+/- test c_str::bench::bench_with_c_str_unchecked_medium ... bench: 30 ns/iter (+/- 7) test c_str::bench::bench_with_c_str_unchecked_short ... bench: 12 ns/iter (+/- 4)
Configuration menu - View commit details
-
Copy full SHA for 2d87803 - Browse repository at this point
Copy the full SHA 2d87803View commit details -
This also fixes a bug in `vec.with_c_str_unchecked` where we were not calling `.to_c_str_unchecked()` for long strings.
5Configuration menu - View commit details
-
Copy full SHA for b1ee87f - Browse repository at this point
Copy the full SHA b1ee87fView commit details
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.