13.05.2017, 14:38
which is faster:
something = ++
something = something + 1
something = ++
something = something + 1
switch(foo)
{
case 1: bar += 1;
case 2: bar += 3;
case 3: bar += 5;
}
by minute value.I will explain why ++var is faster than var++.
var++ is postincrement operator which will take the copy of the var and then increment it and assigns. ++var is preincrement operator which will take the memory address (call by reference) and increments the value and does not require a temporary copy. |