Perfomance optimization

  ... the case you feel the need for a new feature or want to submit one.

Perfomance optimization

Postby lordtao » Mon Aug 30, 2010 3:55 pm


The library always used float instead of int. Is it necessary?

Use Floating-Point Judiciously

As a rule of thumb, floating-point is about 2x slower than integer on Android devices. This is true on a FPU-less, JIT-less G1 and a Nexus One with an FPU and the JIT. (Of course, absolute speed difference between those two devices is about 10x for arithmetic operations.)

In speed terms, there's no difference between float and double on the more modern hardware. Space-wise, double is 2x larger. As with desktop machines, assuming space isn't an issue, you should prefer double to float.

Also, even for integers, some chips have hardware multiply but lack hardware divide. In such cases, integer division and modulus operations are performed in software — something to think about if you're designing a hash table or doing lots of math.
Posts: 2
Joined: Wed Aug 04, 2010 11:06 am

Re: Perfomance optimization

Postby Radzell » Mon Aug 30, 2010 6:50 pm

Its use cloat because of game coords are in float not int.
Posts: 467
Joined: Sun Jul 04, 2010 8:52 am

Re: Perfomance optimization

Postby Mimminito » Mon Aug 30, 2010 10:19 pm

Yes, using a float is a lot better for Game development than say an Integer because of the screen and its coordinates. You are able to move in decimals, not pure Integers.
Adam Goodchild
Your AndEngine Forum Moderator!
My Tutorials List
Posts: 360
Joined: Wed Jul 21, 2010 3:08 pm
Location: Chelsmford, UK

Return to Features

Who is online

Users browsing this forum: No registered users and 7 guests