Hi,

I'm interested by the answer to the original question as well :

Which is faster ?

1) Declaring and using local variables in a method (Variable lookup is
faster, but instanciating is slow ? )

2) Declaring and using  a variable that is global to the class
(Instance is reused but lookup is a bit slower ?)

I guess it depends on the type of variable you are declaring, the
speed overhead for creating an object must not be the same than the
one for creating an integer .... Or is it ?

If someone has numbers and ideas on the question I'd like to know.

I made a game "ArmaBoing"(www.armaboing.com) and beside the
occasionnal garbage collector, I manage to get as low as 15ms/frame(66
frames/seconds) on a Hero.
But I'm wondering if I could go even lower than that by redeploying my
variables.

Regards.

On 12 fév, 08:44, "Sasikumar.S" <sasikumar.it1...@gmail.com> wrote:
> Hi,,
>
> In my application i'm using more than 40 variables.
>
> when i try to execute my project it is taking more time than other projects.
>
> Which will make faster loading?..
>
> whether declaring in class or method ?.
>
> *example 1*
>
> Public class sample
> {
>
> private int s1;
> private int s2;
>
> public void sample_method()
> {
>
> }
> }
>
> *example 2:-*
>
> Public class sample
> {
>
> public void sample_method()
>
> {
>
> int s1;
>
> int s2;
>
> }
> }
>
> which one will be fast example 1or example 2 ?....
>
> Any one can tell this?...
>
> --
> Thanks & Regards
> Sasikumar.S

-- 
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