(String[] args)
| 9 | public class BadMicroBenchmark { |
| 10 | static final int SIZE = 250_000_000; |
| 11 | public static void main(String[] args) { |
| 12 | try { // For machines with insufficient memory |
| 13 | long[] la = new long[SIZE]; |
| 14 | System.out.println("setAll: " + |
| 15 | Timer.duration(() -> |
| 16 | Arrays.setAll(la, n -> n))); |
| 17 | System.out.println("parallelSetAll: " + |
| 18 | Timer.duration(() -> |
| 19 | Arrays.parallelSetAll(la, n -> n))); |
| 20 | } catch(OutOfMemoryError e) { |
| 21 | System.out.println("Insufficient memory"); |
| 22 | System.exit(0); |
| 23 | } |
| 24 | } |
| 25 | } |
| 26 | /* Output: |
| 27 | Insufficient memory |
nothing calls this directly
no test coverage detected