Writing Faster Managed Code: Know What Things Cost by Jan Gray

The most noteworthy item in this article was that there was no difference in performance between a property and a field unless the property was marked as virtual (in which case it was 6 times slower.)  Hmmmm….  I would have thought the difference to be negligible not zero.

Also, if you wish to do your own timings the high performance API declarations are as follows:

[System.Runtime.InteropServices.DllImport(“KERNEL32”)]
private static extern bool QueryPerformanceCounter(
ref long lpPerformanceCount);

[System.Runtime.InteropServices.DllImport(“KERNEL32”)]
private static extern bool QueryPerformanceFrequency(
ref long lpFrequency);

Leave a comment

Your email address will not be published. Required fields are marked *