-
-
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
v3: Add Benchmarks for Rewrite Middleware #3092
Conversation
WalkthroughThe recent enhancements to the middleware's testing framework introduce comprehensive benchmarking capabilities. New benchmark functions assess the rewrite middleware's performance under various scenarios, including different return values from 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 @@
## main #3092 +/- ##
=======================================
Coverage 83.67% 83.67%
=======================================
Files 115 115
Lines 8344 8344
=======================================
Hits 6982 6982
Misses 1039 1039
Partials 323 323
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 (1)
- middleware/rewrite/rewrite_test.go (2 hunks)
Additional comments not posted (12)
middleware/rewrite/rewrite_test.go (12)
175-181
: Helper functioncreateApp
: Ensure proper error handling.The helper function
createApp
initializes a new Fiber app with the rewrite middleware. Ensure that the function handles any potential errors during initialization.
183-201
: Benchmark Case: Next always trueThe benchmark case evaluates the performance when the
Next
function always returns true. Ensure that the benchmark accurately measures the performance and reports allocations.
203-221
: Benchmark Case: Next always falseThe benchmark case evaluates the performance when the
Next
function always returns false. Ensure that the benchmark accurately measures the performance and reports allocations.
223-238
: Benchmark Case: Rewrite with tokensThe benchmark case evaluates the performance when the rewrite rules include tokens. Ensure that the benchmark accurately measures the performance and reports allocations.
240-258
: Benchmark Case: Non-matching request with default routeThe benchmark case evaluates the performance when a non-matching request is handled by a default route. Ensure that the benchmark accurately measures the performance and reports allocations.
260-275
: Benchmark Case: Non-matching request without default routeThe benchmark case evaluates the performance when a non-matching request is not handled by a default route. Ensure that the benchmark accurately measures the performance and reports allocations.
278-284
: Helper functioncreateApp
: Ensure proper error handling.The helper function
createApp
initializes a new Fiber app with the rewrite middleware. Ensure that the function handles any potential errors during initialization.
286-304
: Parallel Benchmark Case: Next always trueThe parallel benchmark case evaluates the performance when the
Next
function always returns true. Ensure that the benchmark accurately measures the performance and handles parallel execution correctly.
306-324
: Parallel Benchmark Case: Next always falseThe parallel benchmark case evaluates the performance when the
Next
function always returns false. Ensure that the benchmark accurately measures the performance and handles parallel execution correctly.
326-341
: Parallel Benchmark Case: Rewrite with tokensThe parallel benchmark case evaluates the performance when the rewrite rules include tokens. Ensure that the benchmark accurately measures the performance and handles parallel execution correctly.
343-361
: Parallel Benchmark Case: Non-matching request with default routeThe parallel benchmark case evaluates the performance when a non-matching request is handled by a default route. Ensure that the benchmark accurately measures the performance and handles parallel execution correctly.
363-379
: Parallel Benchmark Case: Non-matching request without default routeThe parallel benchmark case evaluates the performance when a non-matching request is not handled by a default route. Ensure that the benchmark accurately measures the performance and handles parallel execution correctly.
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 (1)
- middleware/rewrite/rewrite_test.go (2 hunks)
Additional comments not posted (2)
middleware/rewrite/rewrite_test.go (2)
278-379
: LGTM! Ensure the function usage is correct.The code changes are approved.
However, ensure that the parallel benchmark function names are correctly used in the codebase.
Verification successful
Function usage is correct.
The
Benchmark_Rewrite_Parallel
function is correctly defined and not referenced elsewhere in the codebase, which is expected for a benchmark function.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the function usage in the codebase. # Test: Search for the function usage. Expect: Only occurrences of the correct function names. rg --type go -A 5 $'Benchmark_Rewrite_Parallel'Length of output: 478
175-276
: LGTM! Ensure the function usage is correct.The code changes are approved.
However, ensure that the benchmark function names are correctly used in the codebase.
Verification successful
Benchmark functions are correctly defined and used.
The benchmark functions
Benchmark_Rewrite
andBenchmark_Rewrite_Parallel
are correctly defined and used within themiddleware/rewrite/rewrite_test.go
file. No issues were found regarding their usage.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the function usage in the codebase. # Test: Search for the function usage. Expect: Only occurrences of the correct function names. rg --type go -A 5 $'Benchmark_Rewrite'Length of output: 895
Script:
#!/bin/bash # Description: Verify the function usage in the codebase. # Test: Search for the function usage. Expect: Only occurrences of the correct function names. rg --type go -A 5 $'Benchmark_Rewrite_Parallel'Length of output: 478
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.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.50
.
Benchmark suite | Current: b19f607 | Previous: 0592e01 | Ratio |
---|---|---|---|
Benchmark_Compress_Levels/Brotli_LevelBestCompression - B/op |
7 B/op |
0 B/op |
+∞ |
Benchmark_Compress_Levels/Zstd_LevelDefault - B/op |
1 B/op |
0 B/op |
+∞ |
Benchmark_Compress_Levels/Zstd_LevelBestCompression - B/op |
1 B/op |
0 B/op |
+∞ |
This comment was automatically generated by workflow using github-action-benchmark.
Description
Related to #3048
Changes introduced
Type of change