So I made this little cruncher to compare them (see attachment).
Here's some results running it on my computer with little or no CPU load
Code: Select all
++i vs. i++
- the statistical approach
Incrementing...done
Post++
X: 1.37e-007
s: 1.17e-005
ZInterval: [4.76e-008,2.27e-007]
++Pre
X: 9.16e-008
s: 9.57e-006
ZInterval: [1.83e-008,1.65e-007]
ZTest result: ++i != i++
s = standard deviance
ZInterval is a range in which the time is 95% certain to fall between for the increment.
The ZTest tests if using i++ or ++i really matters, as you can see in my result, ++i wins. (5% chance to give wrong result)
I've noticed that under load the ZTest often gives the answer that using i++ is just as good as ++i, but mostly every run ++i ends up with the smallest amount of time.