Sorry , it may sound a stupid question.
I don't know much about JVM to understand the operation behind this..
I have around 40 methods that increment different variables
public void incrementA() {
synchronized(this){
a ++ ;
// ++ a ; Possibly this is the fasttest
// a = a +1 ;
}
}
I believe i = i +1 would definately be slower as this would be addition instruction
++i sounds faster to me as it is a preincrement operator
Step:
increment i value by 1
return i
i ++ may be slower
Step:
get value of i into temp
increment value of i by 1
return temp
May be i faltered at some places... Please correct me and guide me on this .. that which would be the faster of them all ??
Thanks