Affects Version/s: None
Fix Version/s: None
I've reported this already some time ago , but since it wasn't noticed I decided to create a bug report.
To run a hello world class which contains only 1 method takes 319046 method calls on Harmony. Out of them 291637 method calls are the calls that happen when Java class loader tries to find Hello.class and 27409 are what it takes for classlib to startup.
I've found these numbers using two simple JVMTI agents that I wrote some time ago. First one  counts all MethodEnter events and outputs method names to log file. Second one  monitors a particular method and writes down a stack trace to the log file. It should be noted that MethodEnter event according to specification is sent by VM only in LIVE phase, that is after classlib startup, so to find out the overall number of method calls I've used debug version of DRLVM with an additional argument -Xtrace:jvmti.event.method.entry:log which wrote down all of the calls to Java method while executing the application.
Parsing the logs for statistics can be done with the following command:
cat method_entry.log | sort | uniq -c | sort -nr > method_entry.log-sorted
It creates a file with the number that each method was called. The absolute champion since my post in  still remains the method Ljava/io/ByteArrayOutputStream;.write(I)V, it is called 131114 times. Using second agent  I've found out that the most popular stack trace for calling ByteArrayOutputStream;.write looks like this (please note that numbers at the ends of the lines are not line numbers, these are the bytecode numbers):
This stack trace occurs 123029 number of times, about 8000 times ByteArrayOutputStream;.write is called from InitManifest class with a bit different stack trace, but all of the calls to write occur from this class. It seems that InitManifest code copies memory by bytes and there is quite a lot of the memory that is copied. This may not be a big problem in the normal execution of Java application because JIT usually inlines such hot methods. Although it is still inefficient, it may be not a big performance hit (actually this should be checked).
But when trying to debug Java code, DRLVM uses JET, which doesn't inline any methods. It has to execute all of them and all of those calls to ByteArrayOutputStream;.write are executed on startup of the application. It takes several minutes to get to the point of executing the actual user program.
 http://thread.gmane.org/gmane.comp.java.harmony.devel/21104/focus=21133 see also messages posted in this subthread by me
|1.||[classlib][archive] removing double entry reads||Open||Unassigned|