Skip to main content

Posts

Showing posts with the label garbage-collection

Why are annotations under Android such a performance issue (slow)?

I'm the lead author of ORMLite which uses Java annotations on classes to build database schemas. A big startup performance problem for our package turns out to be the calling of annotation methods under Android 1.6. I see the same behavior up through 3.0. We are seeing that the following simple annotation code is incredibly GC intensive and a real performance problem. 1000 calls to an annotation method takes almost a second on a fast box. The same code under Java can do 28 million (sic) calls in the same time. We have an annotation that has 25 methods in it and we'd like to do more than 50 of these a second. Does anyone know why this is happening and if there is any work around? There are certainly things that ORMLite can do in terms of caching this information but is there anything that we can do to "fix" annotations under Android? Thanks. public void testAndroidAnnotations() throws Exception { Field field = Foo.class.getDeclaredField("field");

Android code lags due to logging / gc / audioManager

To keep it simple: I'm working on a small app where we want to click several objects after each other. On clicking an object, it is supposed to play a sound. This works well, except that from time to time, the entire app (including LogCat's logging) just freezes for about 5 seconds, after which it seems to catch up. (All threads freeze) With catching up I mean; if you continue clicking during the freeze, after unfreezing, it still knows what to do. The Log is simple: 01-17 14:52:08.292: D/AudioManager(17963): setStreamVolume(streamType:3, index:11, flags:0) 01-17 14:52:08.473: D/dalvikvm(17963): GC_CONCURRENT freed 417K, 48% free 3113K/5895K, external 140K/647K, paused 2ms+4ms 01-17 14:52:09.033: D/AudioManager(17963): setStreamVolume(streamType:3, index:11, flags:0) 01-17 14:52:09.484: D/AudioManager(17963): setStreamVolume(streamType:3, index:11, flags:0) 01-17 14:52:10.174: D/AudioManager(17963): setStreamVolume(streamType:3, index:11, flags:0) 01-17 14:5