Romain - The idea was to see which is faster to cut an int in half -
multiplying by a float (.5) or dividing by two.  I've read that
divides are terribly slow but apparently not as bad as floating point
multiplications w/ a cast back to an int.

Max - The original test was to see how fast certain bits of drawing
code run, which is why the test case is centered around drawing.  I
think it's a totally reasonable test for any code that's going in to a
game because ultimate, your main loop will be running as fast as
possible and you will be drawing as many frames as you can, so this
will show a specific chunk of code's impact on your game's tick rate.
Drawing a black rect w/3 letters of text is lightning fast.  It maxes
out my G1 at 60fps.  While it doesn't represent how many of the
specific operation your phone can do on a separate thread, it DOES
work to show how many you can do in conjunction with some very, very
basic drawing code, which is what any game will have bare minimum.

On May 20, 3:30 pm, Max Salley <[email protected]> wrote:
> Also there's overhead associated with putting the code into the middle
> of the draw loop.  The speed at which this loop runs will depend on
> more than just the code you want to target.  Maybe alter it so that it
> spawns a separate thread which performs whatever code you're testing
> and just have it report back every X iterations how fast its running.
> That would eliminate some of the jitter due to variations in drawing
> time, as well as anything else that the drawing thread is doing.
>
> On May 20, 4:21 pm, Romain Guy <[email protected]> wrote:
>
> > Hi,
>
> > Your results may be skewed. If you are dividing integers by 2 it's not
> > the same as multiplying an integer by 0.5. In the first case, you are
> > performing an integer division, whereas in the second case you are
> > performing a floating point operation (which results in the end in a
> > cast back to integer.)
>
> > If that's what you did, testing operations on an integer, then the
> > result is not surprising.
>
> > On Wed, May 20, 2009 at 12:33 PM, Robert Green <[email protected]> wrote:
>
> > > I thought others would find this really useful so I posted my FPS
> > > counter app that lets you throw whatever code in the draw loop and
> > > prints out an average of the last 10 frames FPS.  I used this to find
> > > out that dividing by 2 is over twice as fast as multiplying by .5,
> > > which is something 2D games do a lot to work with sprite positions.
>
> > > Here is my code for all of you to share and be plentiful with:
>
> > >http://www.rbgrn.net/content/286-how-to-test-android-performance-usin...
>
> > --
> > Romain Guy
> > Android framework engineer
> > [email protected]
>
> > Note: please don't send private questions to me, as I don't have time
> > to provide private support.  All such questions should be posted on
> > public forums, where I and others can see and answer them
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to