-
Notifications
You must be signed in to change notification settings - Fork 1k
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
make DedicatedThreadPool.QueueUserWorkItem<T>
generic
#6156
make DedicatedThreadPool.QueueUserWorkItem<T>
generic
#6156
Conversation
Done to avoid boxing allocations
Originally pasted the wrong baseline benchmark figures - this has been fixed. |
Ah, might need to be another spot I make generic in order to eliminate all of the boxing allocations - the |
Same as before - no impact really BenchmarkDotNet=v0.13.1, OS=Windows 10.0.19044.2006 (21H2)
AMD Ryzen 7 1700, 1 CPU, 16 logical and 8 physical cores
.NET SDK=6.0.201
[Host] : .NET 6.0.3 (6.0.322.12309), X64 RyuJIT
DefaultJob : .NET 6.0.3 (6.0.322.12309), X64 RyuJIT
|
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
I'd almost want to review the IL/ASM around this... It's tricky because AFAIK not all Also, I'd worry that there -might- still be boxing as a result... I mean, here's a -really-, REALLY crazy idea. Looking at #6143, I see you added this:
Is there a reason, that a given DTP, couldn't just do:
That way you'd eliminate boxing while only paying the single alloc... Right? |
Virtually none are structs. |
Then yeah try my idea ..... As it stands I would -expect- any struct |
Changes
Done to avoid boxing allocations - however, the tasks this effects are few and far between so there's not much in the way of measurable impact. Still, may not be a bad idea.
Checklist
For significant changes, please ensure that the following have been completed (delete if not relevant):
ForkJoinDispatcher
andDedicatedThreadPool
#6143 (comment)Latest
v1.4
BenchmarksThis PR's Benchmarks