It turns out that it is slow when I run it in debug mode. So it is not
a big deal. However, if you have a heavy jackson use and want to debug
your code then you got to be really patient.
On Jun 22, 10:59 am, idleSun idle...@gmail.com wrote:
I am using pretty complicated JSON data with Object Mapping to Java
Classes that are of course also pretty complicated (inheritance depth
is high and there are members defined as List and so on). When I
doJacksonobject mapping in a service with a separate process, it took
about 4 sec. But surprisingly, when I tried the same thing in an
Activity or a service in the same process as the Activity's, it took
about ten times more, 40 sec! Super slow. I tried IntentService in the
same process to run it in a different thread than Activity's. And I
also tried setting thread priority to highest. But all gave the same
result, super slow.
I have tested this only on Emulator with Android 2.3 target virtual
device. And I collect some log and attached in the end. What I found
in terms of differences between running in an activity and a service
(with a separate process) are
1. There are some GC_EXPLICIT in Activity case
2. Time difference between GC_CONCURRENT logs are different: ~2 sec
in an Activity, ~300 msec in a Service.
Anyone help and comment are welcome.
LogCat logs ===
06-22 17:32:38.812: DEBUG/qemud(37): fdhandler_accept_event: accepting
on fd 9
06-22 17:32:38.812: DEBUG/qemud(37): created client 0x23a38 listening
on fd 12
06-22 17:32:38.812: DEBUG/qemud(37): fdhandler_event: disconnect on fd
12
06-22 17:32:39.002: DEBUG/dalvikvm(307): GC_EXPLICIT freed 7K, 54%
free 2545K/5511K, external 716K/1038K, paused 65ms
06-22 17:32:39.342: INFO/MapperActivity(12292): Object Mapping Started
in Activity
06-22 17:32:39.402: INFO/MapperActivity(12292): Thread id=12292,
priority=0
06-22 17:32:41.282: DEBUG/dalvikvm(12292): GC_CONCURRENT freed 436K,
54% free 2720K/5831K, external 716K/1038K, paused 6ms+4ms
06-22 17:32:43.492: DEBUG/dalvikvm(12292): GC_CONCURRENT freed 417K,
54% free 2736K/5831K, external 716K/1038K, paused 6ms+4ms
06-22 17:32:43.942: DEBUG/qemud(37): fdhandler_accept_event: accepting
on fd 9
06-22 17:32:43.942: DEBUG/qemud(37): created client 0x23a38 listening
on fd 12
06-22 17:32:43.942: DEBUG/qemud(37): fdhandler_event: disconnect on fd
12
06-22 17:32:45.263: DEBUG/dalvikvm(338): GC_EXPLICIT freed 4K, 55%
free 2573K/5703K, external 716K/1038K, paused 1287ms
06-22 17:32:45.333: DEBUG/dalvikvm(12292): GC_CONCURRENT freed 406K,
53% free 2749K/5831K, external 716K/1038K, paused 6ms+4ms
06-22 17:32:47.473: DEBUG/dalvikvm(12292): GC_CONCURRENT freed 406K,
53% free 2747K/5831K, external 716K/1038K, paused 5ms+4ms
. . .
06-22 17:33:17.262: DEBUG/dalvikvm(12292): GC_CONCURRENT freed 439K,
52% free 2905K/6023K, external 716K/1038K, paused 5ms+4ms
06-22 17:33:18.662: DEBUG/qemud(37): fdhandler_accept_event: accepting
on fd 9
06-22 17:33:18.662: DEBUG/qemud(37): created client 0x23a38 listening
on fd 12
06-22 17:33:18.662: DEBUG/qemud(37): fdhandler_event: disconnect on fd
12
06-22 17:33:19.242: DEBUG/dalvikvm(12292): GC_CONCURRENT freed 436K,
52% free 2909K/6023K, external 716K/1038K, paused 6ms+4ms
06-22 17:33:20.792: INFO/MapperActivity(12292): Object Mapping in
Activity took (msec): 41390
. . .
06-22 17:33:33.452: INFO/MapperService(12302): Object Mapping Started
in Service
06-22 17:33:33.522: INFO/MapperService(12302): Thread id=12302,
priority=0
06-22 17:33:33.932: DEBUG/qemud(37): fdhandler_accept_event: accepting
on fd 9
06-22 17:33:33.932: DEBUG/qemud(37): created client 0x23a38 listening
on fd 12
06-22 17:33:33.932: DEBUG/qemud(37): fdhandler_event: disconnect on fd
12
06-22 17:33:34.032: DEBUG/dalvikvm(12302): GC_CONCURRENT freed 519K,
54% free 2696K/5831K, external 731K/1038K, paused 5ms+4ms
06-22 17:33:34.302: DEBUG/dalvikvm(12302): GC_CONCURRENT freed 550K,
54% free 2719K/5895K, external 731K/1038K, paused 5ms+4ms
06-22 17:33:34.562: DEBUG/dalvikvm(12302): GC_CONCURRENT freed 492K,
54% free 2718K/5895K, external 731K/1038K, paused 5ms+4ms
06-22 17:33:34.852: DEBUG/dalvikvm(12302): GC_CONCURRENT freed 506K,
54% free 2744K/5895K, external 731K/1038K, paused 5ms+4ms
06-22 17:33:35.072: DEBUG/dalvikvm(12302): GC_CONCURRENT freed 539K,
54% free 2717K/5895K, external 731K/1038K, paused 5ms+4ms
06-22 17:33:35.332: DEBUG/dalvikvm(12302): GC_CONCURRENT freed 497K,
54% free 2732K/5895K, external 731K/1038K, paused 5ms+4ms
06-22 17:33:35.582: DEBUG/dalvikvm(12302): GC_CONCURRENT freed 438K,
54% free 2760K/5895K, external 731K/1038K, paused 5ms+4ms
06-22 17:33:35.802: DEBUG/dalvikvm(12302): GC_CONCURRENT freed 566K,
54% free 2765K/5959K, external 731K/1038K, paused 5ms+5ms
06-22 17:33:36.002: DEBUG/dalvikvm(12302): GC_CONCURRENT freed 508K,
54% free 2768K/5959K, external 731K/1038K, paused 5ms+4ms
06-22 17:33:36.232: