File tree Expand file tree Collapse file tree 4 files changed +27
-3
lines changed
Expand file tree Collapse file tree 4 files changed +27
-3
lines changed Original file line number Diff line number Diff line change 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.
Original file line number Diff line number Diff line change 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.
Original file line number Diff line number Diff line change 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.
Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments