0

Which one is more efficient...???

++x, x++ or x+=1

24th Dec 2016, 3:33 AM
Amit
Amit - avatar
1 ответ
+ 5
++x is technically more efficient because it isn't creating a copy of itself, unlike x++ which creates a copy of the unmodified value and then increments. However, the difference between the three is incredibly minute (only a few clock cycles in the CPU). No matter how many of of either you put in your code you will never have any kind of meaningful performance impact.
24th Dec 2016, 4:48 AM
Thomas Stone
Thomas Stone - avatar