@@ -168,20 +168,23 @@ signature that calling the method can't alter the object's state.</p>
168168usually inline the access, and if you need to restrict or debug field access
169169you can add the code at any time.</p>
170170
171- <p>On Android, this is a bad idea. Virtual method calls are expensive,
172- much more so than instance field lookups. It's reasonable to follow
171+ <p>On Android, this can be a bad idea. Virtual method calls can be more
172+ expensive than instance field lookups. It's reasonable to follow
173173common object-oriented programming practices and have getters and setters
174- in the public interface, but within a class you should always access
174+ in the public interface, but within a class you might want to access
175175fields directly.</p>
176176
177177<p>Without a JIT, direct field access is about 3x faster than invoking a
178- trivial getter. With the JIT (where direct field access is as cheap as
179- accessing a local), direct field access is about 7x faster than invoking a
180- trivial getter. This is true in Froyo, but will improve in the future when
181- the JIT inlines getter methods.</p>
178+ trivial getter (one that simply returns the value of a field, without
179+ any dereferencing or array indexing). With the Froyo JIT, direct field
180+ access was about 7x faster than invoking a trivial getter. Since
181+ Gingerbread, though, the JIT inlines trivial getter methods, making
182+ that particular optimization obsolete. Manual inlining guided by
183+ profiling can still be a useful technique in general, though.</a>
182184
183185<p>Note that if you're using ProGuard, you can have the best
184- of both worlds because ProGuard can inline accessors for you.</p>
186+ of both worlds even with non-trival accessors, because ProGuard can inline
187+ for you.</p>
185188
186189<a name="use_final" id="use_final"></a>
187190<h2>Use Static Final For Constants</h2>
0 commit comments