To Optimize or Not to Optimize

It's time to benchmark our new game. The only place we really need to deal with speed is the game screen. We simply placed an FPSCounter instance in the GameScreen class and called its FPSCounter.logFrame() method at the end of the GameScreen.render() method. Here are the results on a Hero, a Droid, and a Nexus One:

Hero (1.5): 01-02 20:58:06.417: DEBUG/FPSCounter(8251): fps: 57 01-02 20:58:07.427: DEBUG/FPSCounter(8251): fps: 57 01-02 20:58:08.447: DEBUG/FPSCounter(8251): fps: 57 01-02 20:58:09.447: DEBUG/FPSCounter(8251): fps: 56 Droid (2.1.1): 01-02 21:03:59.643: DEBUG/FPSCounter(1676): fps: 61 01-02 21:04:00.659: DEBUG/FPSCounter(1676): fps: 59 01-02 21:04:01.659: DEBUG/FPSCounter(1676): fps: 60 01-02 21:04:02.666: ...

Get Beginning Android 4 Games Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.