ladeak
ladeak
Some updates: with the latest preview the `Lock` type seems to be faster in all above cases (1-4 threads) compared to locking a non `Lock` instance.
@halter73 would you have further suggestions?
Reverted this PR to use the scope of using `Lock`-s everywhere. Incorporating the latest measurements (which seemed to be faster in all cases), so `InputFlowControl` and `Http2FrameWriter._windowUpdateLock` uses it. Soon...
@halter73 I have opened a separate PR: https://github.com/dotnet/aspnetcore/pull/57968 for the interlocked changes in `InputFlowControl`
I had similar benchmark results, I can share later today the exact numbers, but the Span one was slightly better jitted (code size was smaller). Happy to use Unsafe.AddByteOffset, however...
@mgravell I agree, just curious on the reasons behind it.
These are the results and [code](https://gist.github.com/ladeak/b410b361d45549c64548912e8971da24) on my machine (I dropped the non-fast path branch compared to your tests): ``` BenchmarkDotNet v0.14.0, Windows 11 (10.0.22631.4037/23H2/2023Update/SunValley3) 12th Gen Intel Core i7-1255U,...
@mgravell , no need to be sorry, I am happy with both ways.
Reverted to the original proposal.
Is there anything else I may follow up in this PR? cc. @mgravell