开发者

Time wasted from startup until the end of OnCreate

I'm developing a casual game. I'm bored to wait before my app is alive and I can play, so I'm trying to reduce all the wasted time: I used a splash screen started via a Thread in the OnCreate; I used an AsyncTask for some init. However, reading the logcat, I see that BEFORE the first instruction of the OnCreate start (that is, the call for the splashscreen thread), I have almost 6 seconds wasted in I-dont-know-why....

    04-25 20:06:42.043: DEBUG/AndroidRuntime(691): CheckJNI is OFF
    04-25 20:06:42.053: INFO/ActivityManager(164): Start proc com.svox.pico for broadcast com.svox.pico/.VoiceDataInstallerReceiver: pid=701 uid=10025 gids={}
    04-25 20:06:42.303: INFO/ActivityManager(164): Process com.android.voicedialer (pid 674) has died.
    04-25 20:06:42.563: INFO/ActivityThread(701): Publishing provider com.svox.pico.providers.SettingsProvider: com.svox.pico.providers.SettingsProvider
    04-25 20:06:42.673: INFO/ActivityManager(164): Start proc com.android.voicedialer for broadcast com.android.voicedialer/.VoiceDialerReceiver: pid=707 uid=10035 gids={3002}
    04-25 20:06:43.073: DEBUG/AndroidRuntime(691): --- registering native functions ---
    04-25 20:06:43.173: DEBUG/VoiceDialerReceiver(707): onReceive Intent { act=android.intent.action.PACKAGE_ADDED dat=package:com.zapmobilegames.herculaneum flg=0x10000000 cmp=com.android.voicedialer/.VoiceDialerReceiver (has extras) }
    04-25 20:06:43.213: VERBOSE/RecognizerEngine(707): deleteCachedGrammarFiles /data/data/com.android.voicedialer/files/openentries.txt
    04-25 20:06:43.213: DEBUG/dalvikvm(681): GC_FOR_MALLOC freed 1689 objects / 111200 bytes in 961ms
    04-25 20:06:43.303: DEBUG/vending(681): [8] LocalAssetCache.buildCache(): No package info for INSTALLED asset -1596932520012319916 (it.vanini.ottavio.android.utility.bt)
    04-25 20:06:43.363: DEBUG/vending(681): [9] LocalAssetDatabase.syncWithPackageManager(): 2 assets for package "com.zapmobilegames.herculaneum": [Ljava.lang.String;@43cb5370
    04-25 20:06:43.533: DEBUG/vending(681): [9] LocalAssetDatabase.notifyListener(): -5299042386818461764 / UNINSTALLED
    04-25 20:06:43.753: DEBUG/vending(681): [9] LocalAssetDatabase.notifyListener(): -3430589060789413441 / UNINSTALLED
    04-25 20:06:43.763: INFO/ActivityManager(164): Process com.pwnwithyourphone.voicecallerid (pid 695) has died.
    04-25 20:06:43.823: INFO/ActivityManager(164): Start proc com.google.android.apps.maps:FriendService for broadcast com.google.android.apps.maps/com.google.googlenav.friend.android.ServiceReceiver: pid=718 uid=10042 gids={3003, 1015}
    04-25 20:06:44.733: INFO/ActivityManager(164): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.zapmobilegames.herculaneum/.Herculaneum }
    04-25 20:06:44.873: DEBUG/AndroidRuntime(691): Shutting down VM
    04-25 20:06:44.873: DEBUG/dalvikvm(691): Debugger has detached; object registry had 1 entries
    04-25 20:06:44.883: INFO/AndroidRuntime(691): NOTE: attach of thread 'Binder Thread #3' failed
    04-25 20:06:44.933: WARN/dalvikvm(691): LinearAlloc 0x0 not freed: 0x410db3a0 len=212
    04-25 20:06:44.973: WARN/dalvikvm(691): LinearAlloc 0x0 not freed: 0x410db478 len=572
    04-25 20:06:45.023: INFO/ActivityManager(164): Start proc com.zapmobilegames.herculaneum for activity com.zapmobilegames.herculaneum/.Herculaneum: pid=727 uid=10066 gids={3003, 1015}
    04-25 20:06:45.153: INFO/ActivityManager(164): Start proc com.google.android.googlequicksearchbox for broadcast com.google.android.googlequicksearchbox/.CorporaUpdateReceiver: pid=732 uid=10038 gids={3003}
    04-25 20:06:45.503: INFO/WindowManager(164): Setting rotation to 1, animFlags=1
    04-25 20:06:45.583: INFO/ActivityManager(164): Config changed: { scale=1.0 imsi=222/99 loc=it_IT touch=3 keys=1/1/2 nav=3/1 orien=2 layout=18 uiMode=17 seq=4}
    04-25 20:06:45.763: INFO/ActivityThread(732): Publishing provider com.google.android.googlequicksearchbox.shortcuts: com.google.android.googlequicksearchbox.ShortcutsProvider
    04-25 20:06:45.803: INFO/ActivityManager(164): Process com.android.voicedialer (pid 707) has died.
    04-25 20:06:45.863: INFO/ActivityThread(732): Publishing provider com.google.android.googlequicksearchbox.google: com.google.android.googlequicksearchbox.google.GoogleSuggestionProvider
    04-25 20:06:46.043: DEBUG/vending(681): [10] LocalAssetDatabase.syncWithPackageManager(): 2 assets for package "com.zapmobilegames.herculaneum": [Ljava.lang.String;@开发者_JAVA百科43d0e508
    04-25 20:06:46.323: INFO/ActivityThread(727): Publishing provider com.example.AdContentProvider: com.greystripe.android.sdk.AdContentProvider
    04-25 20:06:47.213: DEBUG/vending(681): [10] LocalAssetDatabase.notifyListener(): -5299042386818461764 / INSTALLED
    04-25 20:06:47.703: DEBUG/vending(681): [10] LocalAssetDatabase.notifyListener(): -3430589060789413441 / INSTALLED
    04-25 20:06:47.773: INFO/ActivityManager(164): Process com.google.android.apps.maps:FriendService (pid 718) has died.

and also this one:

04-25 20:06:47.893: INFO/QC_CORE(92): OMXCORE API - OMX_Init 
04-25 20:06:47.893: INFO/QC_CORE(92): OMXCORE API - OMX_ComponentNameEnum 4060ba2c 128 0
04-25 20:06:47.893: INFO/QC_CORE(92): OMXCORE API - OMX_ComponentNameEnum 4060ba2c 128 1
04-25 20:06:47.893: INFO/QC_CORE(92): OMXCORE API - OMX_ComponentNameEnum 4060ba2c 128 2
04-25 20:06:47.893: INFO/QC_CORE(92): OMXCORE API - OMX_ComponentNameEnum 4060ba2c 128 3
04-25 20:06:47.893: INFO/QC_CORE(92): OMXCORE API - OMX_ComponentNameEnum 4060ba2c 128 4
04-25 20:06:47.893: INFO/QC_CORE(92): OMXCORE API - OMX_ComponentNameEnum 4060ba2c 128 5
04-25 20:06:48.093: INFO/QC_CORE(92): OMXCORE API - OMX_Init 
04-25 20:06:48.093: INFO/QC_CORE(92): OMXCORE API - OMX_ComponentNameEnum 179e0 128 0
04-25 20:06:48.093: INFO/QC_CORE(92): GetRolesOfComponent OMX.qcom.video.decoder.avc
04-25 20:06:48.093: INFO/QC_CORE(92): GetRolesOfComponent OMX.qcom.video.decoder.avc
04-25 20:06:48.093: INFO/QC_CORE(92): OMXCORE API - OMX_ComponentNameEnum 179e0 128 1
04-25 20:06:48.093: INFO/QC_CORE(92): GetRolesOfComponent OMX.qcom.video.decoder.mpeg4
04-25 20:06:48.093: INFO/QC_CORE(92): GetRolesOfComponent OMX.qcom.video.decoder.mpeg4
04-25 20:06:48.093: INFO/QC_CORE(92): OMXCORE API - OMX_ComponentNameEnum 179e0 128 2
04-25 20:06:48.093: INFO/QC_CORE(92): GetRolesOfComponent OMX.qcom.video.decoder.h263
04-25 20:06:48.093: INFO/QC_CORE(92): GetRolesOfComponent OMX.qcom.video.decoder.h263
04-25 20:06:48.093: INFO/QC_CORE(92): OMXCORE API - OMX_ComponentNameEnum 179e0 128 3
04-25 20:06:48.093: INFO/QC_CORE(92): GetRolesOfComponent OMX.qcom.video.encoder.mpeg4
04-25 20:06:48.093: INFO/QC_CORE(92): GetRolesOfComponent OMX.qcom.video.encoder.mpeg4
04-25 20:06:48.093: INFO/QC_CORE(92): OMXCORE API - OMX_ComponentNameEnum 179e0 128 4
04-25 20:06:48.093: INFO/QC_CORE(92): GetRolesOfComponent OMX.qcom.video.encoder.h263
04-25 20:06:48.093: INFO/QC_CORE(92): GetRolesOfComponent OMX.qcom.video.encoder.h263
04-25 20:06:48.093: INFO/QC_CORE(92): OMXCORE API - OMX_ComponentNameEnum 179e0 128 5
04-25 20:06:48.103: ERROR/(92): A component of name 'OMX.qcom.video.decoder.avc' already exists, ignoring this one.
04-25 20:06:48.103: ERROR/(92): A component of name 'OMX.qcom.video.decoder.mpeg4' already exists, ignoring this one.
04-25 20:06:48.103: ERROR/(92): A component of name 'OMX.qcom.video.decoder.h263' already exists, ignoring this one.
04-25 20:06:48.103: ERROR/(92): A component of name 'OMX.qcom.video.encoder.mpeg4' already exists, ignoring this one.
04-25 20:06:48.103: ERROR/(92): A component of name 'OMX.qcom.video.encoder.h263' already exists, ignoring this one.
04-25 20:06:48.763: INFO/ActivityManager(164): Process com.google.android.voicesearch (pid 656) has died.
04-25 20:06:48.833: VERBOSE/Herculaneum(727): Before splash screen

Any clue? How can I speed up the start of my app?

Thanks for reply!!!


Step #1: Don't do performance tests on devices will all sorts of crap running. While that crap is starting and stopping, it is stealing CPU cycles from your app, in ways you can neither control nor predict at the application level. Do performance tests on as clean of a device as you can manage -- no app widgets, no background services running, no other apps installed, etc.

Step #2: Don't do performance tests while running in a debugger.

That being said...

At 04-25 20:06:44.733, Android began starting the activity. At 04-25 20:06:45.023, the process for your app was started. That quarter-second is due to the other stuff going on with your device.

Between 04-25 20:06:45.023 and 04-25 20:06:47.703 -- nearly three seconds -- I see a bunch of stuff that would appear to be related to your ad provider. Temporarily disable that and see if the performance improves. If it does, contact your ad tech provider (Greystripe, apparently).

BTW, 04-25 20:06:44.733 is about 4 seconds before 04-25 20:06:48.833, not 6.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜