Uh oh!
There was an error while loading. Please reload this page.
use ArrayPool instead of having a private buffer cache - #45690
Conversation
ghost
commented
Dec 7, 2020
Tagging subscribers to this area: @eiriktsarpalis Issue DetailsContributes to #45315
|
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
… objects), switch to Marshal.AllocHGlobal instead
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
jkotas
commented
Aug 13, 2021
@adamsitnik Now that ArrayPool was fixed to pool unlimited size arrays, I think this PR can be resurrect and updated to use ArrayPool unconditionally. |
adamsitnik
commented
Aug 16, 2021
@jkotas done, PTAL |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
5e56129 to
fc4378fComparejkotas
commented
Aug 17, 2021
It looks good to me. I think it would be useful to verify that there is advantage in using the array pool instead of a simpler NativeMemory.Alloc in this situation - #45690 (comment) . |
adamsitnik
commented
Aug 18, 2021
I did some measurements using modified benchmarks from performance repo: Details[Benchmark]publicvoidGetProcessesByName(){foreach(varprocessinProcess.GetProcessesByName(_nonExistingName)){process.Dispose();}}[Benchmark(OperationsPerInvoke=10*24)]publicvoidGetProcesses_Parallel(){Parallel.For(0,24, _ =>// my PC has 24 cores{for(inti=0;i<10;i++){foreach(varprocessinProcess.GetProcesses()){process.Dispose();}}});}[Benchmark(OperationsPerInvoke=10*24)]publicvoidGetProcessesByName_Parallel(){Parallel.For(0,24, _ =>{for(inti=0;i<10;i++){foreach(varprocessinProcess.GetProcessesByName(_nonExistingName)){process.Dispose();}}});}And the results were following: BenchmarkDotNet=v0.13.0.1559-nightly, OS=Windows 10.0.19043.1165 (21H1/May2021Update) AMD Ryzen Threadripper PRO 3945WX 12-Cores, 1 CPU, 24 logical and 12 physical cores .NET SDK=6.0.100-rc.1.21417.19
@stephentoub@jkotas I don't have a strong opinion here. What are your thoughts on this? |
jkotas
commented
Aug 18, 2021
Nit: It can be just NativeLibrary.Alloc. It guarantees sufficient alignment. AlignedAlloc is unnecessary.
I would lean towards using I do not have a strong opinion on this either. Thank you for collecting the numbers! |
adamsitnik
commented
Aug 19, 2021
I've switched to
@jkotas thank you for a lot of good hints and great discussion! |
Uh oh!
There was an error while loading. Please reload this page.
Contributes to #45315
Citrine (28 cores):
Perf (12 cores):
No difference for micro-benchmarks (this was expected):