True Unsafe Code Performance

前端 未结 7 609

I understand unsafe code is more appropriate to access things like the Windows API and do unsafe type castings than to write more performant code, but I would like to ask yo

7条回答
  •  佛祖请我去吃肉
    2020-11-30 11:32

    Well, I would suggest to read this blog-post: MSDN blogs: Array Bounds Check Elimination in the CLR

    This clarifies how bounds-checks are done in C#. Moreover, Thomas Bratts tests seem to me useless (looking at the code) since the JIT removes in his 'save' loops the bound-checks anyway.

提交回复
热议问题