I recently read about Measure Early and Often for Performance, part 2 , it comes with source code and binary .
Extract from the article: "I emphasized that in order to reliably create high-performance programs, you need to understand the performance of the individual components that you use at the beginning of the design process."
So, I used my tool (v0.2.2) for comparison and tried to see the performance of individual components.
Under my computer (x64), the results are as follows:
Name Median Mean StdDev Min Max Samples NOTHING [count=1000] 0.14 0.177 0.164 0 0.651 10 MethodCalls: EmptyStaticFunction() [count=1000 scale=10.0] 1 1.005 0.017 0.991 1.042 10 Loop 1K times [count=1000] 85.116 85.312 0.392 84.93 86.279 10 MethodCalls: EmptyStaticFunction(arg1,...arg5) [count=1000 scale=10.0] 1.163 1.172 0.015 1.163 1.214 10 MethodCalls: aClass.EmptyInstanceFunction() [count=1000 scale=10.0] 1.009 1.011 0.019 0.995 1.047 10 MethodCalls: aClass.Interface() [count=1000 scale=10.0] 1.112 1.121 0.038 1.098 1.233 10 MethodCalls: aSealedClass.Interface() (inlined) [count=1000 scale=10.0] 0 0.008 0.025 0 0.084 10 MethodCalls: aStructWithInterface.Interface() (inlined) [count=1000 scale=10.0] 0 0.008 0.025 0 0.084 10 MethodCalls: aClass.VirtualMethod() [count=1000 scale=10.0] 0.674 0.683 0.025 0.674 0.758 10 MethodCalls: Class.ReturnsValueType() [count=1000 scale=10.0] 2.165 2.16 0.033 2.107 2.209 10
I am surprised to see that the virtual method (0.674) is faster than the non-virtual instance method (1.009) or the static method (1). And the interface is not too slow! (I would expect the interface to be at least 2 times slower).
Since these results come from a reliable source, I wonder how to explain the above findings.
I donโt think the article is out of date, the problem is because the article itself does not say anything about the evidence. All he did was provide a testing tool.
source share