eliminated volatile
This commit is contained in:
parent
8c4b4e7896
commit
620703ef6f
@ -7,13 +7,11 @@ import java.util.function.*;
|
||||
import onjava.Timer;
|
||||
|
||||
public class Summing {
|
||||
static volatile long result;
|
||||
static void timeTest(String id, long checkValue,
|
||||
LongSupplier operation) {
|
||||
System.out.print(id + ": ");
|
||||
Timer timer = new Timer();
|
||||
// Prevent optimization:
|
||||
result = operation.getAsLong();
|
||||
long result = operation.getAsLong();
|
||||
if(result == checkValue)
|
||||
System.out.println(timer.duration() + "ms");
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user