-
Notifications
You must be signed in to change notification settings - Fork 5.2k
SafeFileHandle.ThreadPoolValueTaskSource made ligher by one field #113435
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
This is my first PR to the mighty |
Tagging subscribers to this area: @dotnet/area-system-io |
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.
This is a performance optimization. Do you have any benchmark that shows this makes a difference?
....Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeFileHandle.ThreadPoolValueTaskSource.cs
Outdated
Show resolved
Hide resolved
Let me spin some tomorrow and share what it does. |
@Scooletz, were you able to gather any performance data demonstrating this is a net positive? While this is shaving off a field, it's on an instance that's typically pooled, so in what's expected to be the common case, it's only saving a field on a single instance of a long-lived object. And in exchange it's paying for a cast on each use. It's not obvious to me this is the right trade-off. |
I was not able to show anything measurable here. @stephentoub I think we can close it. |
This PR combines gather/scatter fields in
SafeFileHandle.ThreadPoolValueTaskSource
into one. This saves one reference field inTPVTS
.