jump to navigation

Remarkably slow May 5, 2007

Posted by hackberry in blackberry, software.
trackback

I finally got around to writing a simple benchmark to compare Java implementations. Collatz measures how quickly a Java implemenation (more specifically, an MIDP implementation) can perform basic arithmetic and function calls, by computing the first 30,000 Collatz numbers and measuring how long it takes using System.currentTimeMillis().

I also implemented the same benchmark in C for comparison, and ran a standalone version on Java2SE. Host-based benchmarks were run on a Pentium M 1.4 GHz, using Java version “1.4.2_14-b05″ and midp2.0fcs.

C 33289 iter/ms
Java SE 7990 iter/ms
MIDP 2.0 1595 iter/ms
BlackBerry 8800 240 iter/ms

It’s interesting that the hosted MIDP implementation runs equivalent code slower than JavaSE, but that could be down to a variety of factors (not least, it now occurs to me, that the benchmark inner loop has a function call which is a member of a class which extends and implements in the MIDP version, but not in the JavaSE version; now granted, it’s private static final so in theory it shouldn’t matter).
What’s really interesting, though, is that the Blackberry is six times slower than the hosted MIDP emulator, and 33 times slower than the JavaSE VM. (Never mind the 130x slowdown versus native code.) At speeds like this, I think Javascript (on host) is going to be faster than on-device Java…

Comments»

No comments yet — be the first.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.