People,
I agree to the you comments.
However what I am trying to show it is not a comparison of performance between two the hardware and yes the great difference that exists in time of execution between different versions of one VM of the Sun.
Observing the data in annex, they do not agree that one VM with version 1.3 or 1.4 has a better performance of what one 1.5?
Another detail, hardwares is different yes, and knows that this influence, but to the point of the same program in "supposed" a version of VM to be until 10x slower?
It does not sound as strange?
Below it follows the codes that I executed, if somebody will have time could make the verifications.
Carlos
public class Main {
/** Creates a new instance of Main */
public Main() {
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) throws Exception{
String string = "";
long a = System.currentTimeMillis();
for(int i = 0; i < 100000; i ++)
string += 'a';
System.out.println
((System.currentTimeMillis() - a));
//System.in.read();
}
}
-----------------------------------------------------------------------------------------------------------------
public class Main2 {
/** Cria uma nova instância de Main2 */
public Main2() {
}
public static void main(String[] args) throws Exception{
StringBuffer buffer = new StringBuffer();
long a = System.currentTimeMillis();
for(int i = 0; i < 100000; i ++)
buffer.append('a');
System.out.println((System.currentTimeMillis() - a));
//System.in.read();
}
}
-------------------------------------------------------------------------------------------------------
public class Main3 {
/** Cria uma nova instância de Main3 */
public Main3() {
}
public static void main(String[] args) throws Exception{
StringBuilder builder = new StringBuilder();
long a = System.nanoTime();
for(int i = 0; i < 100000; i ++)
builder.append('a');
System.out.println((System.nanoTime() - a)/1000000);
//System.in.read();
}
}
------------------------------------------------------------
Carlos Santiago
Analista de Dados - META
Programador Java - SCJP 1.4
JCP Member
Blog:
http://macjava.blogspot.com
------------------------------------------------------------