你可以解释一下这个java程序对正常代码和函数调用的时差

时间:2015-09-08 14:53:04

标签: java function time call

执行代码后再交换代码(首先调用显示功能然后调用普通代码),然后再次查看时差。

我不知道为什么会这样。

代码:

update table_name set column_name = 
select rn from ( select column_name, row_number() over (order by column_name) rn  
           from table_name ) xx;

/ *第二次尝试..首先尝试注释尝试这个

bigdata.partitionBy(new HashPartitioner(numPartitions)).foreachPartition(...)

* /         }

import java.util.Date;
    public class Test_time {

        public static void main(String [] args)
        {
            long start_time;
            long end_time;
            long diff;
   //first try      
            start_time =System.nanoTime();
            System.out.println(start_time);
            String g = "g";
            for(int i=0;i<100;i++)
            {
                    g=g+"g";
                }
            end_time = System.nanoTime();
            System.out.println(end_time);

            diff =  end_time - start_time ;
            System.out.println(diff);

            start_time =System.nanoTime();
            System.out.println(start_time);
            display();
            end_time = System.nanoTime();
            System.out.println(end_time);

            diff =  end_time - start_time ;
            System.out.println(diff);

请有人解释一下这种行为。

感谢。

0 个答案:

没有答案