Class PrimeThreads

java.lang.Object
net.kolotyluk.benchmark.PrimeThreads
Direct Known Subclasses:
PrimeThreads_jmhType_B1

public class PrimeThreads extends Object

Prime Numbers with Streams

These benchmarks can take a very long time to complete, and for some tests utilize almost 100% of all CPUs.

Make sure we are running with the right JDK for Project Loom
 $ "${JAVA_HOME}/bin/java" -version
 openjdk version "18-loom" 2022-03-15
 OpenJDK Runtime Environment (build 18-loom+2-74)
 OpenJDK 64-Bit Server VM (build 18-loom+2-74, mixed mode, sharing)
 
Make sure the laboratory has been compiled and installed for benchmarking.
 $ cd laboratory
 $ mvn clean install
 
Run the benchmarks.
 $ cd benchmarks
 $ mvn clean install
 $ java -jar target/benchmarks.jar PrimeNumbers
 
 Benchmark                                 Mode  Cnt        Score        Error
 PrimeThreads.platformPrimesTo_1000        avgt   25      122.004 ±      4.888
 PrimeThreads.platformPrimesTo_10_000      avgt   25      986.577 ±     55.197
 PrimeThreads.platformPrimesTo_10_000_000  avgt   25  1043651.917 ± 139003.151
 PrimeThreads.virtualPrimesTo_1000         avgt   25       33.420 ±      1.142
 PrimeThreads.virtualPrimesTo_10_000       avgt   25       53.476 ±      0.610
 PrimeThreads.virtualPrimesTo_10_000_000   avgt   25    33058.254 ±   1171.181

 Benchmark                                     tested  throughput   ratio
 PrimeThreads.platformPrimesTo_1000               500       4.098   0.274
 PrimeThreads.platformPrimesTo_10_000           5,000       5.068   0.054
 PrimeThreads.platformPrimesTo_10_000_000   5,000,000       4.791   0.032
 PrimeThreads.virtualPrimesTo_1000                500      14.961   3.651
 PrimeThreads.virtualPrimesTo_10_000            5,000      93.500  18.449
 PrimeThreads.virtualPrimesTo_10_000_000    5,000,000     151.248  31.569
 
  • Constructor Details

    • PrimeThreads

      public PrimeThreads()
  • Method Details

    • main

      public static void main(String[] args) throws org.openjdk.jmh.runner.RunnerException
      Throws:
      org.openjdk.jmh.runner.RunnerException
    • virtualPrimesTo_1000

      public void virtualPrimesTo_1000()
    • virtualPrimesTo_10_000

      public void virtualPrimesTo_10_000()
    • virtualPrimesTo_10_000_000

      public void virtualPrimesTo_10_000_000()
    • platformPrimesTo_1000

      public void platformPrimesTo_1000()
    • platformPrimesTo_10_000

      public void platformPrimesTo_10_000()
    • platformPrimesTo_10_000_000

      public void platformPrimesTo_10_000_000()