the following 2 pieces of C-sharp and java code. C-sharp is compiled in debug mode by default, and the speed is the same as that compiled by java with javac. It takes 10s to perform 2 billion floating-point operations, but if C-sharp is compiled in release mode, only 3sQuery java is used. Is there a similar optimization?
(I have seen the options of javac, it seems that none of them can be optimized and compiled, and the corresponding information can not be found on the Internet)
C-sharp Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program {
static void Main(string[] args){
double i = 0.0; double j = 0.0;
System.DateTime currentTime = new System.DateTime();
currentTime = System.DateTime.Now;
System.Console.Write(currentTime);
System.Console.Write("\n");
for (i=0.0; i < 2000000000.0; iPP) { j = i + j; }
currentTime = System.DateTime.Now;
System.Console.Write(currentTime);
System.Console.Read();
}
}
java Code:
import java.util.Date;
import java.text.SimpleDateFormat;
public class a {
public static void main(String[] args) {
double i=0.0,j=0.0;
Date date = new Date();
SimpleDateFormat dateFormat= new SimpleDateFormat("yyyy-MM-dd :hh:mm:ss");
System.out.println(dateFormat.format(date));
for(i=0.0;i<2000000000.0;iPP){
j=i+j;
}
Date date1 = new Date();
SimpleDateFormat dateFormat1= new SimpleDateFormat("yyyy-MM-dd :hh:mm:ss");
System.out.println(dateFormat1.format(date1));
}
}-sharp-sharp-sharp problem description
the environmental background of the problems and what methods you have tried
related codes
/ / Please paste the code text below (do not replace the code with pictures)