Create quick/reliable benchmark with java?
问题 I\'m trying to create a benchmark test with java. Currently I have the following simple method: public static long runTest(int times){ long start = System.nanoTime(); String str = \"str\"; for(int i=0; i<times; i++){ str = \"str\"+i; } return System.nanoTime()-start; } I\'m currently having this loop multiple times within another loop that is happening multiple times and getting the min/max/avg time it takes to run this method through. Then I am starting some activity on another thread and