Skip to content

Commit 6b1dcd1

Browse files
author
Bruce Eckel
committed
Moved Benchmarking intro to "Verifying"
1 parent b0b9fa3 commit 6b1dcd1

File tree

4 files changed

+27
-3
lines changed

4 files changed

+27
-3
lines changed

arrays/BadMicroBenchmark.java renamed to verifying/BadMicroBenchmark.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// arrays/BadMicroBenchmark.java
1+
// verifying/BadMicroBenchmark.java
22
// (c)2016 MindView LLC: see Copyright.txt
33
// We make no guarantees that this code is fit for any purpose.
44
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.

arrays/BadMicroBenchmark2.java renamed to verifying/BadMicroBenchmark2.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// arrays/BadMicroBenchmark2.java
1+
// verifying/BadMicroBenchmark2.java
22
// (c)2016 MindView LLC: see Copyright.txt
33
// We make no guarantees that this code is fit for any purpose.
44
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.

arrays/BadMicroBenchmark3.java renamed to verifying/BadMicroBenchmark3.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// arrays/BadMicroBenchmark3.java
1+
// verifying/BadMicroBenchmark3.java
22
// (c)2016 MindView LLC: see Copyright.txt
33
// We make no guarantees that this code is fit for any purpose.
44
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// verifying/jmhtests/ParallelSetAll.java
2+
// (c)2016 MindView LLC: see Copyright.txt
3+
// We make no guarantees that this code is fit for any purpose.
4+
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
5+
package verifying.jmhtests;
6+
import java.util.*;
7+
import org.openjdk.jmh.annotations.*;
8+
9+
@State(Scope.Thread)
10+
public class ParallelSetAll {
11+
private long[] la;
12+
@Setup
13+
public void setup() {
14+
la = new long[20_000_000];
15+
}
16+
@Benchmark
17+
public void setAll() {
18+
Arrays.setAll(la, n -> n);
19+
}
20+
@Benchmark
21+
public void parallelSetAll() {
22+
Arrays.parallelSetAll(la, n -> n);
23+
}
24+
}

0 commit comments

Comments
 (0)