Interesting Benchmarks

Eric Kolotyluk eric at kolotyluk.net
Mon Nov 8 17:02:16 UTC 2021


Ron, based on your advice, in my loom-lab
<https://github.com/kolotyluk/loom-lab> project I finally did some
benchmarks with JMH, focusing on 'throughput'. The units are in
milliseconds.

 Benchmark                                 Mode  Cnt           Score
 PrimeThreads.platformPrimesTo_1000        avgt   25      131.536 ±
2.860
 PrimeThreads.platformPrimesTo_10_000      avgt   25     1132.570 ±
 88.749
 PrimeThreads.platformPrimesTo_10_000_000  avgt   25   113223.001 ±
95938.331
 PrimeThreads.virtualPrimesTo_1000         avgt   25       32.998 ±
9.349
 PrimeThreads.virtualPrimesTo_10_000       avgt   25       58.174 ±
0.742
 PrimeThreads.virtualPrimesTo_10_000_000   avgt   25    34989.439 ±
 1354.511

 Benchmark                                     tested  throughput   ratio
 PrimeThreads.platformPrimesTo_1000               500       3.801   0.251
 PrimeThreads.platformPrimesTo_10_000           5,000       4.415   0.051
 PrimeThreads.platformPrimesTo_10_000_000   5,000,000       4.416   0.031
 PrimeThreads.virtualPrimesTo_1000                500      15.152   3.986
 PrimeThreads.virtualPrimesTo_10_000            5,000      85.947  19.467
 PrimeThreads.virtualPrimesTo_10_000_000    5,000,000     142.900  32.360

In a test of 5,000,000 threads running, Virtual Threads have 32 times the
throughput of Platform Threads, for this particular application. I would
not have thought it possible to run 5,000,000 Platform Threads.

Given the fans on my system were generally running at full, I think Project
Loom also deserves some bragging rights on saving energy. It would be
interesting to benchmark again with my power meter to see how many Joules
were consumed for Virtual Threads vs Platform Threads.

Thanks again for helping clarify my thinking, I will try to devise some
synthetic benchmarks that are based on just thread performance, without
calculating prime numbers.

Cheers, Eric


More information about the loom-dev mailing list