-
Notifications
You must be signed in to change notification settings - Fork 794
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
Avoid allocations for properties arrays for common cases #1779
Conversation
Need to fix |
I must admit that this is an unusual test. I have never seen such tests before. Now it exist on if (ifaceBytes.Length != classBytes.Length)
{
return false;
} since |
I think we'd need to be careful about the cost and concurrency impact of the memory barriers inserted by CompareExchange before taking this route |
BenchmarkDotNet=v0.13.2, OS=Windows 11 (10.0.22621.1105)
AMD Ryzen 7 6800H with Radeon Graphics, 1 CPU, 16 logical and 8 physical cores
.NET SDK=7.0.102
[Host] : .NET 7.0.2 (7.0.222.60605), X64 RyuJIT AVX2
DefaultJob : .NET 7.0.2 (7.0.222.60605), X64 RyuJIT AVX2
before
after
|
I only need help with |
@nblumhardt Would you like to see more tests? |
Looking good! I'll loop back to this ASAP - sorry about the delay |
Updated with changes from |
failing on linux? |
Still need help. |
# Conflicts: # Serilog.sln
Rebased on dev. Still need help with |
Rebased on dev. @nblumhardt Could you please help with |
The approach of using the single The example of contention-free cache implementation can be found in dotnet/runtime For runtimes with |
I think the synchronization-free stack allocation approach looks really promising; I'm inclined towards avoiding the atomics and heading in that direction - what do you think @sungam3r? |
Hi. I was away from actively supporting OSS for a long time. I like supposed solution, did not know about such API. @epeshk I have one question. I look at your code and it seems to me that boxing should occur on such lines for value types. I understand that the whole purpose of out PRs is to eliminate temporary array allocations for logged items of that array. Boxing of each item is out of scope of our intentions. So in both cases boxing takes place, right? |
These arrays are not stored further and are not used by user code.