Hey, all, I instrumented the Harmony startup module: Harmony VM creation in JNI_GetCreatedJavaVMs of jni.cpp. This module is responsible for creating VM, which includes classpath setting (jar file parsing and handling), class loading & prepariing & initializing, compilation, etc. In my test bed (2.8GHz Core 2 Quad-core, WinXP OS), Harmony will take 170ms to creating VM in client mode (RI is much faster than Harmony, but I don't have the exact number for its VM creation part).
For VM creation module, most time is spent in dll loading (in vm_init1), classpath parsing and jar file processing (in bootstrap_initial_java_classes), class file loading (basic and system classes in preload_classes and initialize_system_class_loader], and compilation (jet part). To reduce the compilation time, I was wondering to postpone the compilation phase, that means, can interpreter be used in startup phase? I just compared the VM creation performance between client and interpreter modes, and found interpreter is 20% faster than client mode. Another optimization in my mind is to reduce the disk I/O time, where I could merge all jars into one big jar to provide .class file. Another possible approach is to pre-load these jar files into disk cache or memory (put all jars into /dev/shm directory under Linux OS). What do you think? Any comments or suggestion are welcome and appreciated. Thx, Wenlong
