Home > dalvik > Dalvik. A small village in iceland

Dalvik. A small village in iceland

… that mostly lives from catching fish and leads a rural life, not doing that fancy stuff that those guys in the cities do.

How very fitting a name for the Android Java VM.

Yesterday I spent over an hour again re-engineering one of my Web Raid classes, the one that picks a fitting color name for a certain color. This class relies on a big list of names + colors taken from Wikipedia, and needs to find the closest match for a given RGB color. I was using a hash map that maps Hue values to lists of colors of that hue value and that then picks the best one.

This is blindingly fast with Hotspot.

With Dalvik, the little step of generating Integer objects for the int hue values slows down the VM to a crawl. Probably Dalvik uses the kind of ancient Garbage collector that Sun was using with 1.1…

Oh well. Now, with a simple array of 4*360 values (so I can have four different colors for one hue key) it works blindingly fast again. But I notice that I need to rewrite major portions of Web Raid to run on an Android device.

Advertisements
Categories: dalvik
  1. No comments yet.
  1. No trackbacks yet.

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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: