-
Notifications
You must be signed in to change notification settings - Fork 10
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
add fiber trim functions #91
Conversation
```md Benchmark_TrimRight/fiber-12 522399795 2.138 ns/op 0 B/op 0 allocs/op Benchmark_TrimRight/fiber-12 578245326 2.084 ns/op 0 B/op 0 allocs/op Benchmark_TrimRight/default-12 345155300 3.380 ns/op 0 B/op 0 allocs/op Benchmark_TrimRight/default-12 366972850 3.328 ns/op 0 B/op 0 allocs/op Benchmark_TrimRightBytes/fiber-12 586471208 2.099 ns/op 0 B/op 0 allocs/op Benchmark_TrimRightBytes/fiber-12 576055069 2.087 ns/op 0 B/op 0 allocs/op Benchmark_TrimRightBytes/default-12 348849292 3.316 ns/op 0 B/op 0 allocs/op Benchmark_TrimRightBytes/default-12 359904445 3.384 ns/op 0 B/op 0 allocs/op Benchmark_TrimLeft/fiber-12 578044544 2.122 ns/op 0 B/op 0 allocs/op Benchmark_TrimLeft/fiber-12 585290433 2.074 ns/op 0 B/op 0 allocs/op Benchmark_TrimLeft/default-12 351906888 3.667 ns/op 0 B/op 0 allocs/op Benchmark_TrimLeft/default-12 330852666 3.448 ns/op 0 B/op 0 allocs/op Benchmark_TrimLeftBytes/fiber-12 545400109 2.239 ns/op 0 B/op 0 allocs/op Benchmark_TrimLeftBytes/fiber-12 544800061 2.270 ns/op 0 B/op 0 allocs/op Benchmark_TrimLeftBytes/default-12 329749006 3.521 ns/op 0 B/op 0 allocs/op Benchmark_TrimLeftBytes/default-12 344199560 3.452 ns/op 0 B/op 0 allocs/op Benchmark_Trim/fiber-12 280692232 4.128 ns/op 0 B/op 0 allocs/op Benchmark_Trim/fiber-12 297070083 3.961 ns/op 0 B/op 0 allocs/op Benchmark_Trim/default-12 232522952 5.163 ns/op 0 B/op 0 allocs/op Benchmark_Trim/default-12 230659057 5.172 ns/op 0 B/op 0 allocs/op Benchmark_Trim/default.trimspace-12 227328967 5.245 ns/op 0 B/op 0 allocs/op Benchmark_Trim/default.trimspace-12 227340775 5.253 ns/op 0 B/op 0 allocs/op Benchmark_TrimBytes/fiber-12 275612090 4.280 ns/op 0 B/op 0 allocs/op Benchmark_TrimBytes/fiber-12 284892168 4.302 ns/op 0 B/op 0 allocs/op Benchmark_TrimBytes/default-12 224021550 5.163 ns/op 0 B/op 0 allocs/op Benchmark_TrimBytes/default-12 239689282 4.922 ns/op 0 B/op 0 allocs/op Benchmark_TrimBytes/default.trimspace-12 216809300 5.514 ns/op 0 B/op 0 allocs/op Benchmark_TrimBytes/default.trimspace-12 218177734 5.603 ns/op 0 B/op 0 allocs/op ```
WalkthroughThe recent changes introduce new string trimming functions and corresponding benchmarks, enhancing the functionality and performance measurement capabilities of the library. Specifically, the Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #91 +/- ##
==========================================
+ Coverage 92.10% 92.48% +0.37%
==========================================
Files 9 9
Lines 380 399 +19
==========================================
+ Hits 350 369 +19
Misses 17 17
Partials 13 13
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (3)
- README.md (2 hunks)
- byteseq.go (1 hunks)
- byteseq_test.go (2 hunks)
Additional comments not posted (20)
byteseq.go (3)
30-44
: LGTM! Verify the function usage in the codebase.The
Trim
function correctly removes leading and trailing characters specified in thecutset
from a byte sequence.However, ensure that all function calls to
Trim
are correctly implemented in the codebase.Verification successful
LGTM! Verification successful.
The
Trim
function is correctly implemented and adequately tested in thebyteseq_test.go
file. No issues were found with its usage in the codebase.
byteseq_test.go
: Verified test cases and benchmarks forTrim
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all function calls to `Trim` match the new implementation. # Test: Search for the function usage. Expect: Correct implementation. rg --type go -A 5 $'Trim'Length of output: 6984
21-27
: LGTM! Verify the function usage in the codebase.The
TrimLeft
function correctly removes leading characters specified in thecutset
from a byte sequence.However, ensure that all function calls to
TrimLeft
are correctly implemented in the codebase.Verification successful
LGTM! Verify the function usage in the codebase.
The
TrimLeft
function is correctly implemented and used in the test cases and benchmarks. The function calls match the new implementation.
byteseq_test.go
: Function calls toTrimLeft
are correctly implemented and tested with both string and byte slice inputs.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all function calls to `TrimLeft` match the new implementation. # Test: Search for the function usage. Expect: Correct implementation. rg --type go -A 5 $'TrimLeft'Length of output: 2140
47-53
: LGTM! Verify the function usage in the codebase.The
TrimRight
function correctly removes trailing characters specified in thecutset
from a byte sequence.However, ensure that all function calls to
TrimRight
are correctly implemented in the codebase.Verification successful
LGTM!
The
TrimRight
function is correctly implemented and thoroughly tested inbyteseq_test.go
for both string and byte slice inputs. The function usage is verified and no issues were found.
byteseq_test.go
: Test cases and benchmarks forTrimRight
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all function calls to `TrimRight` match the new implementation. # Test: Search for the function usage. Expect: Correct implementation. rg --type go -A 5 $'TrimRight'Length of output: 2144
byteseq_test.go (11)
42-42
: Approved: Addition ofb.ReportAllocs()
.The addition of
b.ReportAllocs()
enhances the benchmark by reporting memory allocations.
61-61
: Approved: Addition ofb.ReportAllocs()
.The addition of
b.ReportAllocs()
enhances the benchmark by reporting memory allocations.
76-97
: Approved: Comprehensive test cases.The
Test_TrimRight
function includes comprehensive test cases that cover various scenarios, including edge cases.
99-118
: Approved: Comprehensive benchmark.The
Benchmark_TrimRight
function includes memory allocation reporting and compares the performance of the Fiber and default implementations.
120-139
: Approved: Comprehensive benchmark.The
Benchmark_TrimRightBytes
function includes memory allocation reporting and compares the performance of the Fiber and default implementations.
141-162
: Approved: Comprehensive test cases.The
Test_TrimLeft
function includes comprehensive test cases that cover various scenarios, including edge cases.
164-183
: Approved: Comprehensive benchmark.The
Benchmark_TrimLeft
function includes memory allocation reporting and compares the performance of the Fiber and default implementations.
185-204
: Approved: Comprehensive benchmark.The
Benchmark_TrimLeftBytes
function includes memory allocation reporting and compares the performance of the Fiber and default implementations.
206-228
: Approved: Comprehensive test cases.The
Test_Trim
function includes comprehensive test cases that cover various scenarios, including edge cases.
230-256
: Approved: Comprehensive benchmark.The
Benchmark_Trim
function includes memory allocation reporting and compares the performance of the Fiber and default implementations.
258-284
: Approved: Comprehensive benchmark.The
Benchmark_TrimBytes
function includes memory allocation reporting and compares the performance of the Fiber and default implementations.README.md (6)
32-35
: Approved: Benchmark results forBenchmark_TrimRight
.The results indicate that the Fiber implementation is significantly faster than the default implementation.
37-40
: Approved: Benchmark results forBenchmark_TrimRightBytes
.The results indicate that the Fiber implementation is significantly faster than the default implementation.
42-45
: Approved: Benchmark results forBenchmark_TrimLeft
.The results indicate that the Fiber implementation is significantly faster than the default implementation.
47-50
: Approved: Benchmark results forBenchmark_TrimLeftBytes
.The results indicate that the Fiber implementation is significantly faster than the default implementation.
52-55
: Approved: Benchmark results forBenchmark_Trim
.The results indicate that the Fiber implementation is significantly faster than the default implementation.
59-62
: Approved: Benchmark results forBenchmark_TrimBytes
.The results indicate that the Fiber implementation is significantly faster than the default implementation.
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
Summary by CodeRabbit
New Features
TrimLeft
,Trim
, andTrimRight
, enhancing string manipulation capabilities.Bug Fixes
Documentation