How to disable/enable JIT dynamically

664 views
Skip to first unread message

Tomei

unread,
Nov 29, 2010, 2:31:56 PM11/29/10
to android-platform
We found that one app's start-up time is reduced significantly when
the JIT is disable -- we tried disabling the JIT for the entire
platform, and the app's start-up time is much better. (Sorry I cannot
share the exact statistics).

Is there a way to temporarily disable the JIT during the app launch,
and enable it again after the app is launched?

It seems like we can add a JNI method to muck with these two fields:

gDvmJit.threshold
gDvmJit.codeCacheSize

Is there a better way? If not, what's the recommended way of mucking
with them? :-)

Thanks


Ben Cheng

unread,
Nov 29, 2010, 3:40:01 PM11/29/10
to android-...@googlegroups.com
Hi Tomei,

We do have the desired delay mechanism implemented in dalvik/vm/compiler/Compiler.c

            :
            dvmLockMutex(&gDvmJit.compilerLock);
            /*
             * TUNING: experiment with the delay & perhaps make it
             * target-specific
             */
            dvmRelativeCondWait(&gDvmJit.compilerQueueActivity,
                                 &gDvmJit.compilerLock, 3000, 0);
            dvmUnlockMutex(&gDvmJit.compilerLock);
            :

Currently the delay is set to be 3 seconds. As the comment and your experiment suggested a target specific value is probably needed here to improve the app startup time.

If you look at ./base/core/java/android/app/ActivityThread.java, you will see a bunch of ensureJitEnabled() calls to enable the JIT if the app is believed to be in the post-startup phase. If specifying a larger startup delay doesn't help the app in question, you probably want to check these ensureJitEnabled() calls to see if any of them jumps the gun.

-Ben




--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To post to this group, send email to android-...@googlegroups.com.
To unsubscribe from this group, send email to android-platfo...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-platform?hl=en.


Reply all
Reply to author
Forward
0 new messages