-
Notifications
You must be signed in to change notification settings - Fork 444
fix: improve performance of readStringVarFromBuff #4194
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
Conversation
Optimize readStringVarFromBuff for better performance and memory usage. - The optimizations were tested using new benchmarks: - Short: 33.26% faster, 42.86% less memory usage, 1 fewer allocation. - Medium: 28.34% faster, 54.55% less memory usage, 1 fewer allocation. - Long: 26.90% faster, 73.42% less memory usage, 3 fewer allocations. - Long: with Low Max: 19.12% faster, 48.15% less memory usage, 1 fewer allocation. The overall improvements show significant gains in both execution speed and memory efficiency. For more check eventsreader_bench_test.go. Changes: - Preallocated the buffer with a reasonable initial capacity without initializing data. - Removed TrimLeft call since conversion logic already stops at the first nul byte decoded.
Double check the benchmark:
The results are aligned with yours:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Close: #4081
1. Explain what the PR does
28ec953 fix: improve performance of readStringVarFromBuff
2. Explain how to test it
3. Other comments