Replies: 3 comments 2 replies
-
Can you show these tests? I don't believe that's +30% compared to simple public static ref T Inc<T>(ref T ptr) => ref Unsafe.Add(ref ptr, 1); which is in machine code lea rax, [rcx+S] ; S is sizeof(T) PS: also see API Review Process |
Beta Was this translation helpful? Give feedback.
-
IL doesn't really matter here as it's a jit known pattern. Also, 1 is a const and jit will eliminate that mul anyway. You have to provide an assembly listing of your function to prove it's any faster or better. I doubt it's better than what @gfoidl has already listed above. Also, 0.3 vs 0.4 na don't usually mean one is faster than another it usually means that it's something that can't really be measured precisely |
Beta Was this translation helpful? Give feedback.
-
please add those methods
in my tests it gives +30% performance
Beta Was this translation helpful? Give feedback.
All reactions