Closed azhmur closed 4 years ago
Yes I was actually looking at the init locals issue last night, as it won't be available until .net 5 and I would like this lib to be available to lower .net versions I am Keen to use fody for it instead.
Do you think you are up for a PR ? If not that is cool and I will look into it in the near future after I finish off a couple of other bits.
Yes, I will, only two stackalloc right now.
Yeah, but I suspect that are causing a fair amount of perf impact on the puts.
Tried to run without initialization, and it fails with memory fault.
https://github.com/Drawaes/TrimDB/blob/master/src/TrimDB.Core/TrimDB.Core/SkipList/SkipList.cs#L56
Checks zero and thus require initialization. I think it may be replaced with different condition, which won't require initialization, but i don't get all the picture behind this code unfortunately.
if you put it in a branch i can take a look and see what i can do
Seems to be fixed for newer sources. But no performance difference observed with or without locals init.
While C# feature not yet available https://github.com/dotnet/csharplang/issues/1738 fody plugin can be used: https://github.com/ltrzesniewski/LocalsInit.Fody and it has significant effect for stackalloc heavy methods https://github.com/azhmur/PooledMemoryStream/raw/master/perf.png?raw=true
PS Found your issue as well https://github.com/dotnet/csharplang/issues/868