-
-
Notifications
You must be signed in to change notification settings - Fork 108
perf: bypass RetryHelper and TimeoutHelper when not needed #4291
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
Co-Authored-By: Claude Opus 4.5 <[email protected]>
SummaryPerformance optimization that bypasses RetryHelper and TimeoutHelper wrappers for tests without retry or timeout configuration. Critical Issues1. Logic Error: Fast path condition is incorrect The fast path condition at TestCoordinator.cs:110 checks: if (retryLimit == 0 && !testTimeout.HasValue)However, looking at RetryHelper.cs:11, the retry loop runs for for (var attempt = 0; attempt < maxRetries + 1; attempt++)This means:
The fast path is being taken when 2. Missing context update In the slow path (TestCoordinator.cs:108-133), Fix needed: if (retryLimit == 0 && !testTimeout.HasValue)
{
test.Context.CurrentRetryAttempt = 0; // Add this line
await ExecuteTestLifecycleAsync(test, cancellationToken).ConfigureAwait(false);
}Suggestions1. Add clarifying comment // Fast path: retryLimit == 0 means "no retries" (run once), not "unlimited retries"
if (retryLimit == 0 && !testTimeout.HasValue)2. Performance validation Verdict |
Add fast path that bypasses wrapper overhead for tests without retry or timeout configuration: - Set CurrentRetryAttempt = 0 for consistency with slow path - Add clarifying comment about retryLimit semantics - Extract ExecuteTestLifecycleAsync for clean separation Fixes #4288 Co-Authored-By: Claude Opus 4.5 <[email protected]>
06ccc45 to
e0d59a0
Compare
|
Addressed review feedback:
|
SummaryAdds fast-path optimization that bypasses RetryHelper and TimeoutHelper wrappers when tests have no retry limit and no timeout. Critical IssuesNone found ✅ SuggestionsThe optimization looks solid. A few minor observations:
Verdict✅ APPROVE - No critical issues The performance optimization follows TUnit Performance First principle (Rule 4) and eliminates unnecessary wrapper overhead for the common case. The extracted ExecuteTestLifecycleAsync method improves maintainability by eliminating code duplication between the fast and slow paths. |
Summary
ExecuteTestLifecycleAsyncmethod for clean separationFixes #4288
Test plan
🤖 Generated with Claude Code