UPDATE: I have logged a bug in the Android database at Google Code. It's been assigned to a developer for inspection. If you'd like to follow the status of the bug, go here and vote for it by "starring" it.
Tesuji Games is nearing the release of its first "mobile toy" for the Android platform. Since the primary development phone around here is the Motorola Droid, I was excited to see Verizon begin rolling out the upgrade to Android 2.1 this week. Although I haven't yet received the upgrade, a friend has, and the results were...well, disappointing. Oh, I have no problem with the new features - they seem to work fine. And the live wallpapers? Very nice. My problem is with the performance of my application, which sees its framerate cut virtually in half when run on a Droid with 2.1.
Here is a video I made of two Droids running a test app I wrote to demonstrate the issue. (No, this isn't the eagerly anticipated debut release from Tesuji Games :-)
So what's going on? Both phones have virtually no other apps running (just what's necessary for the operating system to function). The test application is doing about as little as it possibly can do, at least from a game perspective. There is a loop that draws a black background bitmap, then the moving dot, and finally the text to display the frame rate statistics. Most games have a lot more work to do for each frame than this, so it would seem that the best frame rate one would consistently be able to achieve on a 2.1 Droid is 30 FPS. In case you are new to game design, that's not a particularly impressive number. 60 FPS is the accepted standard for smooth game play.
I did some digging with the Android debugging tools and found that there is indeed a difference in the CPU usage profile between the two phones. The process for the test app is called "org.lagtest". Check out these awesome pie charts (click for larger versions):
Droid with 2.0.1:
Droid with 2.1:
It looks as if on 2.0.1 the application is given more CPU to work with, and the "Idle" slice is smaller. (Why does Idle need so much time?) Still, the charts don't seem to explain the drastic difference in frame rate.
Just for grins, I snagged my wife's HTC Droid Eris with Android 1.5 to test on, much to her chagrin (At least she wasn't in the middle of composing an email):
Note that the Eris, which is significantly slower CPU than the Droid was still achieving 59 FPS consistently while running other apps such as email and weather, etc.
Anyway, if you want to check this out for yourself you can get the source code (as an Eclipse project ZIP) for the test application here.
If you just want to run the test on your phone, you can download the APK here.
If anyone has suggestions for a way around this, I'm all ears.