Measuring Performance

So how much faster is the SpriteBatcher method than the method we used in BobTest? I added an FPSCounter to the code and timed it on a Hero, a Droid, and a Nexus One, as we did in the case of BobTest. I also increased the number of targets to 100 and set the maximum number of sprites the SpriteBatcher can render to 102, since we render 100 targets, 1 ball, and 1 cannon. Here are the results:

12-27 23:51:09.400: DEBUG/FPSCounter(2169): fps: 31

12-27 23:51:10.440: DEBUG/FPSCounter(2169): fps: 31

12-27 23:51:11.470: DEBUG/FPSCounter(2169): fps: 32

12-27 23:51:12.500: DEBUG/FPSCounter(2169): fps: 32

12-27 23:50:23.416: DEBUG/FPSCounter(8145): fps: 56

12-27 23:50:24.448: DEBUG/FPSCounter(8145): fps: 56

12-27 23:50:25.456: DEBUG/FPSCounter(8145): fps: 56

12-27 23:50:26.456: DEBUG/FPSCounter(8145): fps: 55

12-27 23:46:57.162: DEBUG/FPSCounter(754): fps: 61 12-27 23:46:58.171: DEBUG/FPSCounter(754): fps: 61 12-27 23:46:59.181: DEBUG/FPSCounter(754): fps: 61 12-27 23:47:00.181: DEBUG/FPSCounter(754): fps: 60

Before we come to any conclusions, let's test the old method as well. Since our example is not equivalent to the old BobTest, I also modified the TextureAtlasTest, which is the same as our current example—the only difference being that it uses the old BobTest method for rendering. Here are the results:

Hero (1.5):

12-

-27

23:

: 53:45.

950:

DEBUG/FPSCounter(2303)

: fps:

46

12-

-27

23:

: 53:46.

720:

DEBUG/dalvikvm(2303): <

GC freed :

12-

-27

23:

: 53:46.

.970:

DEBUG/FPSCounter(2303)

: fps:

40

12-

-27

23:

:53:47.

.980:

DEBUG/FPSCounter(2303)

: fps:

46

12-

-27

23:

: 53:48.

■ 990:

DEBUG/FPSCounter(2303)

: fps:

46

Droid

(2.1.1):

12

-28

00:

03:13

.004:

DEBUG/FPSCounter(8277)

: fps

52

12

-28

00:

03:14

.004:

DEBUG/FPSCounter(8277)

: fps

52

12

-28

00:

03:15

.027:

DEBUG/FPSCounter(8277)

: fps

53

12

-28

00:

03:16

.027:

DEBUG/FPSCounter(8277)

: fps

53

Nexus

One (2.2.1):

12

27

23

: 56:09.

591:

DEBUG/FPSCounter(873):

fps:

61

12

27

23

56:10

591:

DEBUG/FPSCounter(873):

fps:

60

12

27

23

56:11

.601:

DEBUG/FPSCounter(873):

fps:

61

12

27

23

56:12

.601:

DEBUG/FPSCounter(873):

fps:

60

The Hero performs a lot worse with our new SpriteBatcher method as compared to the old way of using glTranslate() and similar methods. The Droid actually benefits from the new SpriteBatcher method, and the Nexus One doesn't really care what we use. If we'd increased the number of targets by another 100, you'd see that the SpriteBatcher method would also be faster on the Nexus One.

So what's up with the Hero? The problem in BobTest was that we called too many OpenGL ES methods, so why is it performing worse now that we're fewer OpenGL ES method calls?

0 0

Post a comment