-
-
Notifications
You must be signed in to change notification settings - Fork 108
perf: make methods synchronous in ObjectLifecycleService
#4405
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
be82e44 to
c2dbf02
Compare
SummaryThis PR optimizes ObjectLifecycleService by removing unnecessary async keywords and using ValueListBuilder for better performance in RegisterArgumentsAsync. Critical IssuesNone found ✅ SuggestionsConsider Task.WhenAll behavior on older .NET versionsIn RegisterArgumentsAsync, the fallback for pre-NET9 targets allocates a new array via .ToArray(), which reduces the performance benefit of using ValueListBuilder. However, this is only for older .NET targets where the span-based Task.WhenAll overload does not exist, so it is a reasonable trade-off. The NET9+ path gets the full benefit. Performance validationThe PR description shows allocation improvements in a screenshot. Since this touches a hot path (object registration), the performance improvement is welcome and aligns with TUnits Performance First principle. Previous Review StatusNo previous comments found. Verdict✅ APPROVE - No critical issues. The changes are clean, correct, and improve performance:
|
asynckeyword making methods synchronousValueListBuilderinRegisterArgumentsAsync, using the newerTask.WhenAll(ReadOnlySpan<Task>)overload where possible.Taskor create an array.Before
After