Repository navigation
Replace some Lists that used Base() with raw arrays - #201
Conversation
|
Starting a review now, but as far as getting rid of IL while keeping Base(), we could've used https://learn.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.unsafeaccessorattribute?view=net-10.0, iirc I just didn't know about it at the time |
We could have but accessing private members is sort of discouraged to do, there is no need to have a Base when just plain arrays solve this with no overhead, no additional code, expresses exactly what its doing. |
|
agreed, just was saying it was silly of me to even use the dynamic IL in the first place |
marchc1
left a comment
There was a problem hiding this comment.
This is a huge nitpick but this is the only thing I noticed
This kills the need of a Base() function which emitted IL, I've added a new utility struct SpanList that works like List on an existing allocated array to avoid having manual counters, on top of the replacement I did convert one case that had this pattern where it goes
arr[counter++] = elemwhich this little new utility is preventing having to do, as a little side effect of the cleanup Mod_RecomputeTranslucency now holds the 128 elements on stack with InlineArray128 and simplified the use of GetMaterialListFromBodyAndSkin using SpanList. Also some minor code cleanup, Memory compared to Span is heavier also it should use ReadOnlySpan for when something isn't supposed to mutate data.