-
-
Save tanzaku/6bb7dc20468f53bce6f20da7fd1e805f to your computer and use it in GitHub Desktop.
ForkJoinPool memo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void main(String[] args) throws InterruptedException, ExecutionException { | |
int seedStart = 1000; | |
int testcase = 100; | |
ForkJoinPool forkJoinPool = new ForkJoinPool(6); | |
double[] res = forkJoinPool.submit(() -> | |
IntStream.range(seedStart, seedStart + testcase) | |
.parallel() | |
.mapToDouble(s -> new PointsOnTheCircleVis().runTest(s+"")) | |
.toArray() | |
).get(); | |
double sum = 0; | |
for (int i = 0; i < res.length; i++) { | |
sum += res[i]; | |
// System.err.println((seedStart + i) + "," + res[i]); | |
} | |
System.err.println(sum); | |
for (int i = 0; i < res.length; i++) { | |
System.err.println(res[i]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment