【发布时间】:2015-01-05 18:54:03
【问题描述】:
我想知道在每个对象的方法中将成员变量复制到本地堆栈变量中是否会导致性能下降?
class X {
Another instanceOfAnother;
void foo() {
Another local = instanceOfAnother; //Would like to know if this causes a performance hit
//with regards to any garbage collection
//infrastructure
}
}
【问题讨论】:
-
JIT 会优化,我声称。