I am a bit rusty on the use of final methods.. I do know they cant be
extended.. but I also thought that modern JVMs "inline" final methods or
something..to help speed them up?

On Fri, Jan 29, 2010 at 3:47 PM, Streets Of Boston
<flyingdutc...@gmail.com>wrote:

> I'm not sure about DalvikVM, but some compilers take advantage of
> 'final'.
>
> E.g.
> Final variables can be put in registers of the CPU without worrying
> that they may change during execution (constantly moving variable-
> values back and forth from memory to registers could be omitted for
> 'final' vars).
>
> Or the compiler itself may do some better optimization of binary code
> generation if it knows that a variable is 'final' and will never
> change.
>
> ...
>
>
> On Jan 28, 4:53 am, Tim Russell <t...@jatra.co.uk> wrote:
> > I've seen a lot of use of final for local primitives.
> >
> > Presumable to indicate to the compiler that the value shouldn't be
> changed.
> >
> > However, what's the implication of this on Dalvik?
> >
> > I believe final local variables are usually placed on the heap for
> extended
> > lifetime (for use in inner classes), so is their a runtime overhead
> rather
> > than using simple locals (which use Dalvik registers)?
> >
> > Thanks,
> >  Tim
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to