-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
🚀 Performance improvements #2838
Merged
Merged
Conversation
This file contains 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
- fix expected cookie values in tests
Co-Authored-By: Thomas van Vugt <thomasvvugt@users.noreply.github.com>
Co-Authored-By: Thomas van Vugt <thomasvvugt@users.noreply.github.com> Co-Authored-By: Queru <pascal@queru.net>
Co-Authored-By: RW <renewerner87@googlemail.com>
Co-Authored-By: RW <renewerner87@googlemail.com>
Co-Authored-By: RW <renewerner87@googlemail.com>
Co-Authored-By: RW <renewerner87@googlemail.com>
Co-Authored-By: RW <renewerner87@googlemail.com>
Co-Authored-By: RW <renewerner87@googlemail.com>
# Conflicts: # ctx.go # router.go
Co-Authored-By: RW <renewerner87@googlemail.com>
Co-Authored-By: RW <renewerner87@googlemail.com>
Co-Authored-By: RW <renewerner87@googlemail.com>
Co-Authored-By: RW <renewerner87@googlemail.com>
Co-Authored-By: RW <renewerner87@googlemail.com>
Co-Authored-By: RW <renewerner87@googlemail.com>
Use optimized `utils.ToString` and avoid `once.Do` **Before** ``` BenchmarkLogfKeyAndValues/test_logf_with_debug_level_and_key-values-24 7323432 153.8 ns/op 89 B/op 1 allocs/op BenchmarkLogfKeyAndValues/test_logf_with_info_level_and_key-values-24 8171703 144.5 ns/op 81 B/op 1 allocs/op BenchmarkLogfKeyAndValues/test_logf_with_warn_level_and_key-values-24 8207860 142.8 ns/op 81 B/op 1 allocs/op BenchmarkLogfKeyAndValues/test_logf_with_format_and_key-values-24 7500332 159.1 ns/op 135 B/op 2 allocs/op BenchmarkLogfKeyAndValues/test_logf_with_one_key-24 10024760 131.0 ns/op 155 B/op 2 allocs/op ``` **After** ``` BenchmarkLogfKeyAndValues/test_logf_with_debug_level_and_key-values-24 13797813 77.42 ns/op 77 B/op 0 allocs/op BenchmarkLogfKeyAndValues/test_logf_with_info_level_and_key-values-24 15375350 75.43 ns/op 73 B/op 1 allocs/op BenchmarkLogfKeyAndValues/test_logf_with_warn_level_and_key-values-24 14926300 75.28 ns/op 75 B/op 1 allocs/op BenchmarkLogfKeyAndValues/test_logf_with_format_and_key-values-24 12860275 90.27 ns/op 134 B/op 2 allocs/op BenchmarkLogfKeyAndValues/test_logf_with_one_key-24 15649615 74.98 ns/op 100 B/op 1 allocs/op ```
# Original fn using Sprintf Benchmark_Ctx_String-24 3846717 318.0 ns/op 152 B/op 8 allocs/op Benchmark_Ctx_String-24 3780208 315.9 ns/op 152 B/op 8 allocs/op Benchmark_Ctx_String-24 3627513 315.1 ns/op 152 B/op 8 allocs/op Benchmark_Ctx_String-24 3712863 317.4 ns/op 152 B/op 8 allocs/op // Modified using bytebufferpool Benchmark_Ctx_String-24 8131666 149.3 ns/op 96 B/op 5 allocs/op Benchmark_Ctx_String-24 7626406 148.3 ns/op 96 B/op 5 allocs/op Benchmark_Ctx_String-24 8194621 149.2 ns/op 96 B/op 5 allocs/op Benchmark_Ctx_String-24 8297750 156.6 ns/op 96 B/op 5 allocs/op
thx you are awesome just 2 linter errors and the unneeded comments are pending
|
ReneWerner87
approved these changes
Feb 9, 2024
ReneWerner87
approved these changes
Feb 9, 2024
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.
Sprintf
withbytebufferpool
inctx.String()
Sprintf
withbytebufferpool
inmiddleware/logger#default
utils.ToString
and avoidonce.Do
inlog