Closed zhoupc2015 closed 10 months ago
Need a prove that it is making significant impact on api use, from my experience not makying any change with modern .net5+ JIT. Kind of finicky as all structures usually point to data and have small size. Jit is unfolding loops if it does not it still N(O). Giving this if you like to access frame buffer indeed it will improve timings but please explain yourself. I would opt for System.Runtime.CompilerServices.UnsafeIntel MKL or AMD but need actual reason why. Hoverer, please hold in mind I don't whan't any not GPL or MIT code present here - as LGPL is the only model I can do here.
I will close it till I get explanation why coping few kilobytes fast make any sense
You are right, it's great to learn from you, thank you! I ran my test method a little more, and it’s exactly what you said. I’m sorry.
you don't need to sorry or so, as you a part of community - I don't use library in any commercial way, but many others do - so I value any attempt to make it better than it is now.
…M_MEMORY_COPY, which can change the code from a for loop to the form of Buffer.MemoryCopy. For example, the method ToArray and UpdateFrom of the structure byte_array61440:
public byte[] ToArray() { var a = new byte[61440]; for (uint i = 0; i < 61440; i++) a[i] = [i]; return a; } becomes public byte[] ToArray() { var a = new byte[61440];fixed (byte* src = , dst = a){ Buffer.MemoryCopy(src, dst, 61440, 61440); } return a; }
public void UpdateFrom(byte[] array) { uint i = 0; foreach(var value in array) { [i++] = value; if (i >= 61440) return; } } becomes public void UpdateFrom(byte[] array) { fixed (byte* src = array, dst = ){ Buffer.MemoryCopy(src, dst, 61440, Math.Min(61440, array.Length)); } }