Am I reading this right? The performace difference seems to be unaccounted for in the data
Performance counter stats for './x86_64-binary 5000000' (5 runs):
6,883,819,114 cycles # 2.090 GHz ( +- 0.43% )
232,004,486 instructions # 0.03 insns per cycle ( +- 0.06% )
56,828,213 branches # 17.257 M/sec ( +- 0.04% )
1,262,892 branch-misses # 2.22% of all branches ( +- 0.05% )
3.299025345 seconds time elapsed ( +- 0.43% )
Performance counter stats for './x86_64-vtable 5000000' (5 runs):
7,709,225,443 cycles # 2.087 GHz ( +- 0.95% )
217,283,422 instructions # 0.03 insns per cycle ( +- 0.03% )
51,631,368 branches # 13.976 M/sec ( +- 0.03% )
957,553 branch-misses # 1.85% of all branches ( +- 0.10% )
3.706410106 seconds time elapsed ( +- 1.04% )
One would assume with all else being equal that code which ran fewer instructions with fewer branches and a better branch prediction rate would be faster.Given that is not what we get, can we assume that 'all else was not equal' Where did the cycles get used? Average cost of branch-miss? Cache miss? Loading the pointers from the jump table with rep movsb?