The performance between the 'normal' operation and the 'shift' operation.

First, I gonna post my test result with some code:

 //test the peformance of the <normal operation> and the <shift operation>.
class ShiftOperation
{
public static void main(String[] args)
{
long startTime1 = System.nanoTime();
for(long i = 0; i < 10000000000L; i++){
int temp = 128 * 128;
}
long endTime1 = System.nanoTime();
System.out.println("elapse = " + (endTime1 - startTime1) + " ns");
//outputs:elapse = 13265249285 ns long startTime2 = System.nanoTime();
for(long i = 0; i < 10000000000L; i++){
int temp = 128 << 8;
}
long endTime2 = System.nanoTime();
System.out.println("elapse = " + (endTime2 - startTime2) + " ns");
//outputs:elapse = 12723663971 ns
}
}

The below screen shot shows the simple steps of the operations between the two.

The performance between the 'normal' operation and the 'shift' operation.

上一篇:利用HBuilder开发基于MUI的H5+ app中使用百度地图定位功能


下一篇:c# 中get和post的方法