System.out.print("Float64 add: ");
startTime();
for (int i = 0; i < 10000; i++) {
StackContext.enter();
Float64 x = Float64.ONE;
for (int j = 0; j < results.length; j++) {
results[j] = x.plus(x);
}
StackContext.exit();
}
endTime(10000 * results.length);
System.out.print("Float64 multiply: ");
startTime();
for (int i = 0; i < 10000; i++) {
StackContext.enter();
Float64 x = Float64.valueOf(1.0);
for (int j = 0; j < results.length; j++) {
results[j] = x.times(x);
}
StackContext.exit();
}
endTime(10000 * results.length);
System.out.print("Complex add: ");
startTime();
for (int i = 0; i < 10000; i++) {
StackContext.enter();
Complex x = Complex.valueOf(1.0, 2.0);
for (int j = 0; j < results.length; j++) {
results[j] = x.plus(x);
}
StackContext.exit();
}
endTime(10000 * results.length);
System.out.print("Complex multiply: ");
startTime();
for (int i = 0; i < 10000; i++) {
StackContext.enter();
Complex x = Complex.valueOf(1.0, 2.0);
for (int j = 0; j < results.length; j++) {
results[j] = x.times(x);
}
StackContext.exit();
}
endTime(10000 * results.length);
System.out.print("Amount<Mass> add: ");
startTime();
for (int i = 0; i < 10000; i++) {
StackContext.enter();
Amount<Mass> x = Amount.valueOf(1.0, SI.KILOGRAM);
for (int j = 0; j < results.length; j++) {
results[j] = x.plus(x);
}
StackContext.exit();
}
endTime(10000 * results.length);
System.out.print("Amount<Mass> multiply: ");
startTime();
for (int i = 0; i < 10000; i++) {
StackContext.enter();
Amount<Mass> x = Amount.valueOf(1.0, SI.KILOGRAM);
for (int j = 0; j < results.length; j++) {
results[j] = x.times(x);
}
StackContext.exit();
}
endTime(10000 * results.length);