#2207 efficiency of &var vs var

lel4866 Mon 18 Nov 2013

Is there any difference in speed when referring to a field in a method with &var versus var? Of course, I mean only when there is no defined getter/setter.

SlimerDude Mon 18 Nov 2013

Um, I would imagine not...

...but I don't know for sure. :/

brian Mon 18 Nov 2013

Going thru the getter and setter typically gets optimized away by HotSpot so I wouldn't worry about it. Plus internal to a pod, as long as the field isn't virtual and there is no explicit getter/setter defined, then we actually compile it down to field access opcode anyhow.

Login or Signup to reply.