Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • lara/cs206-demos
  • gcharles/cs206-demos
  • gambhir/cs206-demos
3 results
Show changes
Showing
with 939 additions and 8 deletions
[
{
"jmhVersion" : "1.36",
"benchmark" : "benchmarks.AppendBenchmark.bench00_prepend",
"mode" : "thrpt",
"threads" : 1,
"forks" : 4,
"jvm" : "/private/var/root/Library/Caches/Coursier/arc/https/github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.6%252B10/OpenJDK17U-jdk_x64_mac_hotspot_17.0.6_10.tar.gz/jdk-17.0.6+10/Contents/Home/bin/java",
"jvmArgs" : [
],
"jdkVersion" : "17.0.6",
"vmName" : "OpenJDK 64-Bit Server VM",
"vmVersion" : "17.0.6+10",
"warmupIterations" : 5,
"warmupTime" : "2 s",
"warmupBatchSize" : 1,
"measurementIterations" : 5,
"measurementTime" : "2 s",
"measurementBatchSize" : 1,
"params" : {
"seqType" : "List"
},
"primaryMetric" : {
"score" : 4.893678169190596E8,
"scoreError" : 3425286.2912830976,
"scoreConfidence" : [
4.859425306277765E8,
4.9279310321034265E8
],
"scorePercentiles" : {
"0.0" : 4.800557005610914E8,
"50.0" : 4.902576285241723E8,
"90.0" : 4.944236268146865E8,
"95.0" : 4.946731063957179E8,
"99.0" : 4.946765552159545E8,
"99.9" : 4.946765552159545E8,
"99.99" : 4.946765552159545E8,
"99.999" : 4.946765552159545E8,
"99.9999" : 4.946765552159545E8,
"100.0" : 4.946765552159545E8
},
"scoreUnit" : "ops/s",
"rawData" : [
[
4.8390509621676195E8,
4.800557005610914E8,
4.8637443340739936E8,
4.852674063610991E8,
4.8553897115019083E8
],
[
4.8797121593511873E8,
4.8501024296307E8,
4.9126698289142776E8,
4.900086424689439E8,
4.909485992739081E8
],
[
4.9252044258667123E8,
4.8977032454141927E8,
4.9241139472755885E8,
4.9276805884585804E8,
4.905066145794008E8
],
[
4.8833953737193274E8,
4.946765552159545E8,
4.9275111897748905E8,
4.926574214946739E8,
4.94607578811223E8
]
]
},
"secondaryMetrics" : {
}
},
{
"jmhVersion" : "1.36",
"benchmark" : "benchmarks.AppendBenchmark.bench00_prepend",
"mode" : "thrpt",
"threads" : 1,
"forks" : 4,
"jvm" : "/private/var/root/Library/Caches/Coursier/arc/https/github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.6%252B10/OpenJDK17U-jdk_x64_mac_hotspot_17.0.6_10.tar.gz/jdk-17.0.6+10/Contents/Home/bin/java",
"jvmArgs" : [
],
"jdkVersion" : "17.0.6",
"vmName" : "OpenJDK 64-Bit Server VM",
"vmVersion" : "17.0.6+10",
"warmupIterations" : 5,
"warmupTime" : "2 s",
"warmupBatchSize" : 1,
"measurementIterations" : 5,
"measurementTime" : "2 s",
"measurementBatchSize" : 1,
"params" : {
"seqType" : "Array"
},
"primaryMetric" : {
"score" : 274162.7628903021,
"scoreError" : 2338.355032641355,
"scoreConfidence" : [
271824.4078576607,
276501.1179229435
],
"scorePercentiles" : {
"0.0" : 265310.5428446132,
"50.0" : 274262.2938556825,
"90.0" : 277493.4684822387,
"95.0" : 278733.0403197289,
"99.0" : 278794.62250167964,
"99.9" : 278794.62250167964,
"99.99" : 278794.62250167964,
"99.999" : 278794.62250167964,
"99.9999" : 278794.62250167964,
"100.0" : 278794.62250167964
},
"scoreUnit" : "ops/s",
"rawData" : [
[
272648.0903424814,
275371.6028551139,
275254.7678348332,
274080.3706066835,
273171.1422737155
],
[
272667.33599022956,
274319.9698406046,
274584.892930142,
275925.08555001806,
276867.875058399
],
[
272635.685802109,
274204.6178707603,
275334.11700525833,
265310.5428446132,
272905.19803954824
],
[
272920.68640606396,
273755.7773934639,
277562.97886266536,
278794.62250167964,
274939.8977976595
]
]
},
"secondaryMetrics" : {
}
},
{
"jmhVersion" : "1.36",
"benchmark" : "benchmarks.AppendBenchmark.bench01_append",
"mode" : "thrpt",
"threads" : 1,
"forks" : 4,
"jvm" : "/private/var/root/Library/Caches/Coursier/arc/https/github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.6%252B10/OpenJDK17U-jdk_x64_mac_hotspot_17.0.6_10.tar.gz/jdk-17.0.6+10/Contents/Home/bin/java",
"jvmArgs" : [
],
"jdkVersion" : "17.0.6",
"vmName" : "OpenJDK 64-Bit Server VM",
"vmVersion" : "17.0.6+10",
"warmupIterations" : 5,
"warmupTime" : "2 s",
"warmupBatchSize" : 1,
"measurementIterations" : 5,
"measurementTime" : "2 s",
"measurementBatchSize" : 1,
"params" : {
"seqType" : "List"
},
"primaryMetric" : {
"score" : 17096.931737178664,
"scoreError" : 507.90917707806057,
"scoreConfidence" : [
16589.022560100602,
17604.840914256725
],
"scorePercentiles" : {
"0.0" : 16196.471331211134,
"50.0" : 17153.67902926314,
"90.0" : 17789.543001933987,
"95.0" : 17827.922733924283,
"99.0" : 17829.488421007303,
"99.9" : 17829.488421007303,
"99.99" : 17829.488421007303,
"99.999" : 17829.488421007303,
"99.9999" : 17829.488421007303,
"100.0" : 17829.488421007303
},
"scoreUnit" : "ops/s",
"rawData" : [
[
17416.510194772924,
17595.37408043214,
17571.971124055493,
17586.792202253037,
17632.775189617172
],
[
17572.550208971596,
17798.174679346892,
17649.892353502215,
17711.857905217865,
17829.488421007303
],
[
16890.847863753363,
16196.471331211134,
16421.243728556292,
16265.25760846098,
16513.46208762414
],
[
16457.78397375109,
16449.053507162662,
16808.02986821921,
16859.09457510693,
16712.003840550915
]
]
},
"secondaryMetrics" : {
}
},
{
"jmhVersion" : "1.36",
"benchmark" : "benchmarks.AppendBenchmark.bench01_append",
"mode" : "thrpt",
"threads" : 1,
"forks" : 4,
"jvm" : "/private/var/root/Library/Caches/Coursier/arc/https/github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.6%252B10/OpenJDK17U-jdk_x64_mac_hotspot_17.0.6_10.tar.gz/jdk-17.0.6+10/Contents/Home/bin/java",
"jvmArgs" : [
],
"jdkVersion" : "17.0.6",
"vmName" : "OpenJDK 64-Bit Server VM",
"vmVersion" : "17.0.6+10",
"warmupIterations" : 5,
"warmupTime" : "2 s",
"warmupBatchSize" : 1,
"measurementIterations" : 5,
"measurementTime" : "2 s",
"measurementBatchSize" : 1,
"params" : {
"seqType" : "Array"
},
"primaryMetric" : {
"score" : 238323.213961686,
"scoreError" : 77612.87736804709,
"scoreConfidence" : [
160710.33659363893,
315936.0913297331
],
"scorePercentiles" : {
"0.0" : 73766.81259042509,
"50.0" : 290610.7144673075,
"90.0" : 313443.2424886844,
"95.0" : 326257.0067899261,
"99.0" : 326898.73311655596,
"99.9" : 326898.73311655596,
"99.99" : 326898.73311655596,
"99.999" : 326898.73311655596,
"99.9999" : 326898.73311655596,
"100.0" : 326898.73311655596
},
"scoreUnit" : "ops/s",
"rawData" : [
[
326898.73311655596,
294169.65138080175,
307854.56563121785,
289012.3084432803,
302312.11691508105
],
[
292714.2471422587,
314064.20658395847,
302659.8098916822,
257611.0973836947,
166652.52768673014
],
[
113239.36481021093,
111431.86489893375,
131214.71910471836,
73828.75973458456,
73766.81259042509
],
[
225051.81895117802,
292209.1204913347,
302920.29515894485,
300481.2022735654,
288371.0570445642
]
]
},
"secondaryMetrics" : {
}
}
]
[info] welcome to sbt 1.7.1 (Eclipse Adoptium Java 17.0.6)
[info] loading settings for project cs206-demos-build-build-build from metals.sbt ...
[info] loading project definition from /Users/mbovel/cs206-demos/project/project/project
[info] loading settings for project cs206-demos-build-build from metals.sbt ...
[info] loading project definition from /Users/mbovel/cs206-demos/project/project
[success] Generated .bloop/cs206-demos-build-build.json
[success] Total time: 0 s, completed Mar 5, 2023, 12:55:52 PM
[info] loading settings for project cs206-demos-build from metals.sbt,plugins.sbt ...
[info] loading project definition from /Users/mbovel/cs206-demos/project
[success] Generated .bloop/cs206-demos-build.json
[success] Total time: 0 s, completed Mar 5, 2023, 12:55:52 PM
[info] loading settings for project cs206-demos from build.sbt ...
[info] set current project to cs206-demos (in build file:/Users/mbovel/cs206-demos/)
[success] Total time: 0 s, completed Mar 5, 2023, 12:55:53 PM
[info] compiling 7 Scala sources and 1 Java source to /Users/mbovel/cs206-demos/target/scala-3.2.0/classes ...
[warn] there was 1 deprecation warning; re-run with -deprecation for details
[warn] one warning found
[info] done compiling
[info] running org.openjdk.jmh.generators.bytecode.JmhBytecodeGenerator /Users/mbovel/cs206-demos/target/scala-3.2.0/classes /Users/mbovel/cs206-demos/target/scala-3.2.0/src_managed/jmh /Users/mbovel/cs206-demos/target/scala-3.2.0/resource_managed/jmh default
Processing 18 classes from /Users/mbovel/cs206-demos/target/scala-3.2.0/classes with "reflection" generator
Writing out Java source to /Users/mbovel/cs206-demos/target/scala-3.2.0/src_managed/jmh and resources to /Users/mbovel/cs206-demos/target/scala-3.2.0/resource_managed/jmh
[info] compiling 22 Java sources to /Users/mbovel/cs206-demos/target/scala-3.2.0/classes ...
[info] done compiling
[info] running (fork) org.openjdk.jmh.Main -wi 5 -w 2 -i 5 -r 2 -f 4 -rf JSON -rff benchmarks/results/01-AppendBenchmark-openjdk-2.json AppendBenchmark
[info] # JMH version: 1.36
[info] # VM version: JDK 17.0.6, OpenJDK 64-Bit Server VM, 17.0.6+10
[info] # VM invoker: /private/var/root/Library/Caches/Coursier/arc/https/github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.6%252B10/OpenJDK17U-jdk_x64_mac_hotspot_17.0.6_10.tar.gz/jdk-17.0.6+10/Contents/Home/bin/java
[info] # VM options: <none>
[info] # Blackhole mode: compiler (auto-detected, use -Djmh.blackhole.autoDetect=false to disable)
[info] # Warmup: 5 iterations, 2 s each
[info] # Measurement: 5 iterations, 2 s each
[info] # Timeout: 10 min per iteration
[info] # Threads: 1 thread, will synchronize iterations
[info] # Benchmark mode: Throughput, ops/time
[info] # Benchmark: benchmarks.AppendBenchmark.bench00_prepend
[info] # Parameters: (seqType = List)
[info] # Run progress: 0.00% complete, ETA 00:05:20
[info] # Fork: 1 of 4
[info] # Warmup Iteration 1: 351700723.794 ops/s
[info] # Warmup Iteration 2: 442326063.471 ops/s
[info] # Warmup Iteration 3: 482146561.904 ops/s
[info] # Warmup Iteration 4: 483658907.401 ops/s
[info] # Warmup Iteration 5: 482756851.941 ops/s
[info] Iteration 1: 483905096.217 ops/s
[info] Iteration 2: 480055700.561 ops/s
[info] Iteration 3: 486374433.407 ops/s
[info] Iteration 4: 485267406.361 ops/s
[info] Iteration 5: 485538971.150 ops/s
[info] # Run progress: 6.25% complete, ETA 00:05:05
[info] # Fork: 2 of 4
[info] # Warmup Iteration 1: 350719571.619 ops/s
[info] # Warmup Iteration 2: 451206807.714 ops/s
[info] # Warmup Iteration 3: 490100763.137 ops/s
[info] # Warmup Iteration 4: 487314789.690 ops/s
[info] # Warmup Iteration 5: 488113654.210 ops/s
[info] Iteration 1: 487971215.935 ops/s
[info] Iteration 2: 485010242.963 ops/s
[info] Iteration 3: 491266982.891 ops/s
[info] Iteration 4: 490008642.469 ops/s
[info] Iteration 5: 490948599.274 ops/s
[info] # Run progress: 12.50% complete, ETA 00:04:45
[info] # Fork: 3 of 4
[info] # Warmup Iteration 1: 363573271.893 ops/s
[info] # Warmup Iteration 2: 462069479.886 ops/s
[info] # Warmup Iteration 3: 492345947.173 ops/s
[info] # Warmup Iteration 4: 492191071.421 ops/s
[info] # Warmup Iteration 5: 492139581.795 ops/s
[info] Iteration 1: 492520442.587 ops/s
[info] Iteration 2: 489770324.541 ops/s
[info] Iteration 3: 492411394.728 ops/s
[info] Iteration 4: 492768058.846 ops/s
[info] Iteration 5: 490506614.579 ops/s
[info] # Run progress: 18.75% complete, ETA 00:04:24
[info] # Fork: 4 of 4
[info] # Warmup Iteration 1: 364944800.124 ops/s
[info] # Warmup Iteration 2: 465323902.710 ops/s
[info] # Warmup Iteration 3: 494130840.274 ops/s
[info] # Warmup Iteration 4: 494837429.876 ops/s
[info] # Warmup Iteration 5: 494424176.116 ops/s
[info] Iteration 1: 488339537.372 ops/s
[info] Iteration 2: 494676555.216 ops/s
[info] Iteration 3: 492751118.977 ops/s
[info] Iteration 4: 492657421.495 ops/s
[info] Iteration 5: 494607578.811 ops/s
[info] Result "benchmarks.AppendBenchmark.bench00_prepend":
[info] 489367816.919 ±(99.9%) 3425286.291 ops/s [Average]
[info] (min, avg, max) = (480055700.561, 489367816.919, 494676555.216), stdev = 3944564.787
[info] CI (99.9%): [485942530.628, 492793103.210] (assumes normal distribution)
[info] # JMH version: 1.36
[info] # VM version: JDK 17.0.6, OpenJDK 64-Bit Server VM, 17.0.6+10
[info] # VM invoker: /private/var/root/Library/Caches/Coursier/arc/https/github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.6%252B10/OpenJDK17U-jdk_x64_mac_hotspot_17.0.6_10.tar.gz/jdk-17.0.6+10/Contents/Home/bin/java
[info] # VM options: <none>
[info] # Blackhole mode: compiler (auto-detected, use -Djmh.blackhole.autoDetect=false to disable)
[info] # Warmup: 5 iterations, 2 s each
[info] # Measurement: 5 iterations, 2 s each
[info] # Timeout: 10 min per iteration
[info] # Threads: 1 thread, will synchronize iterations
[info] # Benchmark mode: Throughput, ops/time
[info] # Benchmark: benchmarks.AppendBenchmark.bench00_prepend
[info] # Parameters: (seqType = Array)
[info] # Run progress: 25.00% complete, ETA 00:04:04
[info] # Fork: 1 of 4
[info] # Warmup Iteration 1: 237676.397 ops/s
[info] # Warmup Iteration 2: 273790.235 ops/s
[info] # Warmup Iteration 3: 275467.418 ops/s
[info] # Warmup Iteration 4: 275771.821 ops/s
[info] # Warmup Iteration 5: 277771.672 ops/s
[info] Iteration 1: 272648.090 ops/s
[info] Iteration 2: 275371.603 ops/s
[info] Iteration 3: 275254.768 ops/s
[info] Iteration 4: 274080.371 ops/s
[info] Iteration 5: 273171.142 ops/s
[info] # Run progress: 31.25% complete, ETA 00:03:44
[info] # Fork: 2 of 4
[info] # Warmup Iteration 1: 237634.994 ops/s
[info] # Warmup Iteration 2: 273381.633 ops/s
[info] # Warmup Iteration 3: 273584.442 ops/s
[info] # Warmup Iteration 4: 273792.013 ops/s
[info] # Warmup Iteration 5: 278053.274 ops/s
[info] Iteration 1: 272667.336 ops/s
[info] Iteration 2: 274319.970 ops/s
[info] Iteration 3: 274584.893 ops/s
[info] Iteration 4: 275925.086 ops/s
[info] Iteration 5: 276867.875 ops/s
[info] # Run progress: 37.50% complete, ETA 00:03:23
[info] # Fork: 3 of 4
[info] # Warmup Iteration 1: 233125.681 ops/s
[info] # Warmup Iteration 2: 275188.759 ops/s
[info] # Warmup Iteration 3: 275966.930 ops/s
[info] # Warmup Iteration 4: 272522.073 ops/s
[info] # Warmup Iteration 5: 273351.390 ops/s
[info] Iteration 1: 272635.686 ops/s
[info] Iteration 2: 274204.618 ops/s
[info] Iteration 3: 275334.117 ops/s
[info] Iteration 4: 265310.543 ops/s
[info] Iteration 5: 272905.198 ops/s
[info] # Run progress: 43.75% complete, ETA 00:03:03
[info] # Fork: 4 of 4
[info] # Warmup Iteration 1: 237741.675 ops/s
[info] # Warmup Iteration 2: 275667.300 ops/s
[info] # Warmup Iteration 3: 274290.395 ops/s
[info] # Warmup Iteration 4: 276886.796 ops/s
[info] # Warmup Iteration 5: 275197.592 ops/s
[info] Iteration 1: 272920.686 ops/s
[info] Iteration 2: 273755.777 ops/s
[info] Iteration 3: 277562.979 ops/s
[info] Iteration 4: 278794.623 ops/s
[info] Iteration 5: 274939.898 ops/s
[info] Result "benchmarks.AppendBenchmark.bench00_prepend":
[info] 274162.763 ±(99.9%) 2338.355 ops/s [Average]
[info] (min, avg, max) = (265310.543, 274162.763, 278794.623), stdev = 2692.853
[info] CI (99.9%): [271824.408, 276501.118] (assumes normal distribution)
[info] # JMH version: 1.36
[info] # VM version: JDK 17.0.6, OpenJDK 64-Bit Server VM, 17.0.6+10
[info] # VM invoker: /private/var/root/Library/Caches/Coursier/arc/https/github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.6%252B10/OpenJDK17U-jdk_x64_mac_hotspot_17.0.6_10.tar.gz/jdk-17.0.6+10/Contents/Home/bin/java
[info] # VM options: <none>
[info] # Blackhole mode: compiler (auto-detected, use -Djmh.blackhole.autoDetect=false to disable)
[info] # Warmup: 5 iterations, 2 s each
[info] # Measurement: 5 iterations, 2 s each
[info] # Timeout: 10 min per iteration
[info] # Threads: 1 thread, will synchronize iterations
[info] # Benchmark mode: Throughput, ops/time
[info] # Benchmark: benchmarks.AppendBenchmark.bench01_append
[info] # Parameters: (seqType = List)
[info] # Run progress: 50.00% complete, ETA 00:02:43
[info] # Fork: 1 of 4
[info] # Warmup Iteration 1: 15907.896 ops/s
[info] # Warmup Iteration 2: 17543.361 ops/s
[info] # Warmup Iteration 3: 17562.433 ops/s
[info] # Warmup Iteration 4: 17506.153 ops/s
[info] # Warmup Iteration 5: 17606.084 ops/s
[info] Iteration 1: 17416.510 ops/s
[info] Iteration 2: 17595.374 ops/s
[info] Iteration 3: 17571.971 ops/s
[info] Iteration 4: 17586.792 ops/s
[info] Iteration 5: 17632.775 ops/s
[info] # Run progress: 56.25% complete, ETA 00:02:22
[info] # Fork: 2 of 4
[info] # Warmup Iteration 1: 15921.777 ops/s
[info] # Warmup Iteration 2: 17614.063 ops/s
[info] # Warmup Iteration 3: 17664.387 ops/s
[info] # Warmup Iteration 4: 17708.036 ops/s
[info] # Warmup Iteration 5: 17754.180 ops/s
[info] Iteration 1: 17572.550 ops/s
[info] Iteration 2: 17798.175 ops/s
[info] Iteration 3: 17649.892 ops/s
[info] Iteration 4: 17711.858 ops/s
[info] Iteration 5: 17829.488 ops/s
[info] # Run progress: 62.50% complete, ETA 00:02:02
[info] # Fork: 3 of 4
[info] # Warmup Iteration 1: 16069.859 ops/s
[info] # Warmup Iteration 2: 16463.425 ops/s
[info] # Warmup Iteration 3: 16269.710 ops/s
[info] # Warmup Iteration 4: 16324.154 ops/s
[info] # Warmup Iteration 5: 16297.561 ops/s
[info] Iteration 1: 16890.848 ops/s
[info] Iteration 2: 16196.471 ops/s
[info] Iteration 3: 16421.244 ops/s
[info] Iteration 4: 16265.258 ops/s
[info] Iteration 5: 16513.462 ops/s
[info] # Run progress: 68.75% complete, ETA 00:01:41
[info] # Fork: 4 of 4
[info] # Warmup Iteration 1: 15278.443 ops/s
[info] # Warmup Iteration 2: 16907.713 ops/s
[info] # Warmup Iteration 3: 16914.745 ops/s
[info] # Warmup Iteration 4: 16906.849 ops/s
[info] # Warmup Iteration 5: 16919.514 ops/s
[info] Iteration 1: 16457.784 ops/s
[info] Iteration 2: 16449.054 ops/s
[info] Iteration 3: 16808.030 ops/s
[info] Iteration 4: 16859.095 ops/s
[info] Iteration 5: 16712.004 ops/s
[info] Result "benchmarks.AppendBenchmark.bench01_append":
[info] 17096.932 ±(99.9%) 507.909 ops/s [Average]
[info] (min, avg, max) = (16196.471, 17096.932, 17829.488), stdev = 584.909
[info] CI (99.9%): [16589.023, 17604.841] (assumes normal distribution)
[info] # JMH version: 1.36
[info] # VM version: JDK 17.0.6, OpenJDK 64-Bit Server VM, 17.0.6+10
[info] # VM invoker: /private/var/root/Library/Caches/Coursier/arc/https/github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.6%252B10/OpenJDK17U-jdk_x64_mac_hotspot_17.0.6_10.tar.gz/jdk-17.0.6+10/Contents/Home/bin/java
[info] # VM options: <none>
[info] # Blackhole mode: compiler (auto-detected, use -Djmh.blackhole.autoDetect=false to disable)
[info] # Warmup: 5 iterations, 2 s each
[info] # Measurement: 5 iterations, 2 s each
[info] # Timeout: 10 min per iteration
[info] # Threads: 1 thread, will synchronize iterations
[info] # Benchmark mode: Throughput, ops/time
[info] # Benchmark: benchmarks.AppendBenchmark.bench01_append
[info] # Parameters: (seqType = Array)
[info] # Run progress: 75.00% complete, ETA 00:01:21
[info] # Fork: 1 of 4
[info] # Warmup Iteration 1: 282434.850 ops/s
[info] # Warmup Iteration 2: 327567.263 ops/s
[info] # Warmup Iteration 3: 324002.695 ops/s
[info] # Warmup Iteration 4: 330791.419 ops/s
[info] # Warmup Iteration 5: 329071.154 ops/s
[info] Iteration 1: 326898.733 ops/s
[info] Iteration 2: 294169.651 ops/s
[info] Iteration 3: 307854.566 ops/s
[info] Iteration 4: 289012.308 ops/s
[info] Iteration 5: 302312.117 ops/s
[info] # Run progress: 81.25% complete, ETA 00:01:01
[info] # Fork: 2 of 4
[info] # Warmup Iteration 1: 161724.285 ops/s
[info] # Warmup Iteration 2: 244821.235 ops/s
[info] # Warmup Iteration 3: 243622.158 ops/s
[info] # Warmup Iteration 4: 308415.193 ops/s
[info] # Warmup Iteration 5: 315329.987 ops/s
[info] Iteration 1: 292714.247 ops/s
[info] Iteration 2: 314064.207 ops/s
[info] Iteration 3: 302659.810 ops/s
[info] Iteration 4: 257611.097 ops/s
[info] Iteration 5: 166652.528 ops/s
[info] # Run progress: 87.50% complete, ETA 00:00:40
[info] # Fork: 3 of 4
[info] # Warmup Iteration 1: 136955.280 ops/s
[info] # Warmup Iteration 2: 224680.879 ops/s
[info] # Warmup Iteration 3: 223524.474 ops/s
[info] # Warmup Iteration 4: 118912.147 ops/s
[info] # Warmup Iteration 5: 133508.554 ops/s
[info] Iteration 1: 113239.365 ops/s
[info] Iteration 2: 111431.865 ops/s
[info] Iteration 3: 131214.719 ops/s
[info] Iteration 4: 73828.760 ops/s
[info] Iteration 5: 73766.813 ops/s
[info] # Run progress: 93.75% complete, ETA 00:00:20
[info] # Fork: 4 of 4
[info] # Warmup Iteration 1: 149663.322 ops/s
[info] # Warmup Iteration 2: 131250.281 ops/s
[info] # Warmup Iteration 3: 151107.370 ops/s
[info] # Warmup Iteration 4: 197408.259 ops/s
[info] # Warmup Iteration 5: 192316.822 ops/s
[info] Iteration 1: 225051.819 ops/s
[info] Iteration 2: 292209.120 ops/s
[info] Iteration 3: 302920.295 ops/s
[info] Iteration 4: 300481.202 ops/s
[info] Iteration 5: 288371.057 ops/s
[info] Result "benchmarks.AppendBenchmark.bench01_append":
[info] 238323.214 ±(99.9%) 77612.877 ops/s [Average]
[info] (min, avg, max) = (73766.813, 238323.214, 326898.733), stdev = 89379.105
[info] CI (99.9%): [160710.337, 315936.091] (assumes normal distribution)
[info] # Run complete. Total time: 00:05:27
[info] REMEMBER: The numbers below are just data. To gain reusable insights, you need to follow up on
[info] why the numbers are the way they are. Use profilers (see -prof, -lprof), design factorial
[info] experiments, perform baseline and negative tests that provide experimental control, make sure
[info] the benchmarking environment is safe on JVM/OS/HW level, ask for reviews from the domain experts.
[info] Do not assume the numbers tell you what you want them to tell.
[info] NOTE: Current JVM experimentally supports Compiler Blackholes, and they are in use. Please exercise
[info] extra caution when trusting the results, look into the generated code to check the benchmark still
[info] works, and factor in a small probability of new VM bugs. Additionally, while comparisons between
[info] different JVMs are already problematic, the performance difference caused by different Blackhole
[info] modes can be very significant. Please make sure you use the consistent Blackhole mode for comparisons.
[info] Benchmark (seqType) Mode Cnt Score Error Units
[info] AppendBenchmark.bench00_prepend List thrpt 20 489367816.919 ± 3425286.291 ops/s
[info] AppendBenchmark.bench00_prepend Array thrpt 20 274162.763 ± 2338.355 ops/s
[info] AppendBenchmark.bench01_append List thrpt 20 17096.932 ± 507.909 ops/s
[info] AppendBenchmark.bench01_append Array thrpt 20 238323.214 ± 77612.877 ops/s
[info] Benchmark result is saved to benchmarks/results/01-AppendBenchmark-openjdk-2.json
[success] Total time: 333 s (05:33), completed Mar 5, 2023, 1:01:26 PM
#!/usr/bin/env bash
run=1
run=2
run_benchmark() {
name=$1
......@@ -18,7 +18,7 @@ run_benchmarks() {
eval "$(coursier java --jvm "$jvm_coursier_id" --env)"
for bench in "02-SumBenchmark" "01-AppendBenchmark"; do
for bench in "01-AppendBenchmark"; do
run_benchmark $bench $jvm
done
}
......
# 2. SumBenchmark
![](graphs/SumBenchmark-bar-h.svg)
<svg class="main-svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="1000" height="500" style="" viewBox="0 0 1000 500"><rect x="0" y="0" width="1000" height="500" style="fill: rgb(255, 255, 255); fill-opacity: 1;"/><defs id="defs-e63d07"><g class="clips"><clipPath id="clipe63d07xyplot" class="plotclip"><rect width="583" height="360"/></clipPath><clipPath class="axesclip" id="clipe63d07x"><rect x="299" y="0" width="583" height="500"/></clipPath><clipPath class="axesclip" id="clipe63d07y"><rect x="0" y="60" width="1000" height="360"/></clipPath><clipPath class="axesclip" id="clipe63d07xy"><rect x="299" y="60" width="583" height="360"/></clipPath></g><g class="gradients"/><g class="patterns"/></defs><g class="bglayer"/><g class="layer-below"><g class="imagelayer"/><g class="shapelayer"/></g><g class="cartesianlayer"><g class="subplot xy"><g class="layer-subplot"><g class="shapelayer"/><g class="imagelayer"/></g><g class="minor-gridlayer"><g class="x"/><g class="y"/></g><g class="gridlayer"><g class="x"><path class="xgrid crisp" transform="translate(413.97,0)" d="M0,60v360" style="stroke: rgb(235, 240, 248); stroke-opacity: 1; stroke-width: 1px;"/><path class="xgrid crisp" transform="translate(528.94,0)" d="M0,60v360" style="stroke: rgb(235, 240, 248); stroke-opacity: 1; stroke-width: 1px;"/><path class="xgrid crisp" transform="translate(643.9100000000001,0)" d="M0,60v360" style="stroke: rgb(235, 240, 248); stroke-opacity: 1; stroke-width: 1px;"/><path class="xgrid crisp" transform="translate(758.87,0)" d="M0,60v360" style="stroke: rgb(235, 240, 248); stroke-opacity: 1; stroke-width: 1px;"/><path class="xgrid crisp" transform="translate(873.84,0)" d="M0,60v360" style="stroke: rgb(235, 240, 248); stroke-opacity: 1; stroke-width: 1px;"/></g><g class="y"/></g><g class="zerolinelayer"><path class="xzl zl crisp" transform="translate(299,0)" d="M0,60v360" style="stroke: rgb(235, 240, 248); stroke-opacity: 1; stroke-width: 2px;"/></g><path class="xlines-below"/><path class="ylines-below"/><g class="overlines-below"/><g class="xaxislayer-below"/><g class="yaxislayer-below"/><g class="overaxes-below"/><g class="plot" transform="translate(299,60)" clip-path="url(#clipe63d07xyplot)"><g class="barlayer mlayer"><g class="trace bars" style="opacity: 1;"><g class="points"><g class="point"><path d="M0,357V345H52.1V357Z" style="vector-effect: none; opacity: 1; stroke-width: 0.5px; fill: rgb(251, 180, 174); fill-opacity: 1; stroke: rgb(255, 255, 255); stroke-opacity: 1;"/></g><g class="point"><path d="M0,327V315H52.34V327Z" style="vector-effect: none; opacity: 1; stroke-width: 0.5px; fill: rgb(251, 180, 174); fill-opacity: 1; stroke: rgb(255, 255, 255); stroke-opacity: 1;"/></g><g class="point"><path d="M0,297V285H51.2V297Z" style="vector-effect: none; opacity: 1; stroke-width: 0.5px; fill: rgb(251, 180, 174); fill-opacity: 1; stroke: rgb(255, 255, 255); stroke-opacity: 1;"/></g><g class="point"><path d="M0,267V255H0.01V267Z" style="vector-effect: none; opacity: 1; stroke-width: 0.5px; fill: rgb(251, 180, 174); fill-opacity: 1; stroke: rgb(255, 255, 255); stroke-opacity: 1;"/></g><g class="point"><path d="M0,237V225H26.13V237Z" style="vector-effect: none; opacity: 1; stroke-width: 0.5px; fill: rgb(251, 180, 174); fill-opacity: 1; stroke: rgb(255, 255, 255); stroke-opacity: 1;"/></g><g class="point"><path d="M0,207V195H467.82V207Z" style="vector-effect: none; opacity: 1; stroke-width: 0.5px; fill: rgb(251, 180, 174); fill-opacity: 1; stroke: rgb(255, 255, 255); stroke-opacity: 1;"/></g><g class="point"><path d="M0,177V165H467.99V177Z" style="vector-effect: none; opacity: 1; stroke-width: 0.5px; fill: rgb(251, 180, 174); fill-opacity: 1; stroke: rgb(255, 255, 255); stroke-opacity: 1;"/></g><g class="point"><path d="M0,147V135H54.99V147Z" style="vector-effect: none; opacity: 1; stroke-width: 0.5px; fill: rgb(251, 180, 174); fill-opacity: 1; stroke: rgb(255, 255, 255); stroke-opacity: 1;"/></g><g class="point"><path d="M0,117V105H496.16V117Z" style="vector-effect: none; opacity: 1; stroke-width: 0.5px; fill: rgb(251, 180, 174); fill-opacity: 1; stroke: rgb(255, 255, 255); stroke-opacity: 1;"/></g><g class="point"><path d="M0,87V75H495.53V87Z" style="vector-effect: none; opacity: 1; stroke-width: 0.5px; fill: rgb(251, 180, 174); fill-opacity: 1; stroke: rgb(255, 255, 255); stroke-opacity: 1;"/></g><g class="point"><path d="M0,57V45H496.73V57Z" style="vector-effect: none; opacity: 1; stroke-width: 0.5px; fill: rgb(251, 180, 174); fill-opacity: 1; stroke: rgb(255, 255, 255); stroke-opacity: 1;"/></g><g class="point"><path d="M0,27V15H24.88V27Z" style="vector-effect: none; opacity: 1; stroke-width: 0.5px; fill: rgb(251, 180, 174); fill-opacity: 1; stroke: rgb(255, 255, 255); stroke-opacity: 1;"/></g></g><g class="errorbar" style="opacity: 1;"><path class="xerror" d="M58.55,347v8m0,-4H47.6m0,-4v8" style="vector-effect: none; stroke-width: 2px; stroke: rgb(42, 63, 95); stroke-opacity: 1;"/></g><g class="errorbar" style="opacity: 1;"><path class="xerror" d="M59.43,317v8m0,-4H47.63m0,-4v8" style="vector-effect: none; stroke-width: 2px; stroke: rgb(42, 63, 95); stroke-opacity: 1;"/></g><g class="errorbar" style="opacity: 1;"><path class="xerror" d="M56.61,287v8m0,-4H46.99m0,-4v8" style="vector-effect: none; stroke-width: 2px; stroke: rgb(42, 63, 95); stroke-opacity: 1;"/></g><g class="errorbar" style="opacity: 1;"><path class="xerror" d="M0.01,257v8m0,-4H0.01m0,-4v8" style="vector-effect: none; stroke-width: 2px; stroke: rgb(42, 63, 95); stroke-opacity: 1;"/></g><g class="errorbar" style="opacity: 1;"><path class="xerror" d="M32.33,227v8m0,-4H22.47m0,-4v8" style="vector-effect: none; stroke-width: 2px; stroke: rgb(42, 63, 95); stroke-opacity: 1;"/></g><g class="errorbar" style="opacity: 1;"><path class="xerror" d="M484.09,197v8m0,-4H459.64m0,-4v8" style="vector-effect: none; stroke-width: 2px; stroke: rgb(42, 63, 95); stroke-opacity: 1;"/></g><g class="errorbar" style="opacity: 1;"><path class="xerror" d="M493.36,167v8m0,-4H461.32m0,-4v8" style="vector-effect: none; stroke-width: 2px; stroke: rgb(42, 63, 95); stroke-opacity: 1;"/></g><g class="errorbar" style="opacity: 1;"><path class="xerror" d="M59.49,137v8m0,-4H54.2m0,-4v8" style="vector-effect: none; stroke-width: 2px; stroke: rgb(42, 63, 95); stroke-opacity: 1;"/></g><g class="errorbar" style="opacity: 1;"><path class="xerror" d="M520.51,107v8m0,-4H489.4m0,-4v8" style="vector-effect: none; stroke-width: 2px; stroke: rgb(42, 63, 95); stroke-opacity: 1;"/></g><g class="errorbar" style="opacity: 1;"><path class="xerror" d="M524.2,77v8m0,-4H487.61m0,-4v8" style="vector-effect: none; stroke-width: 2px; stroke: rgb(42, 63, 95); stroke-opacity: 1;"/></g><g class="errorbar" style="opacity: 1;"><path class="xerror" d="M553.85,47v8m0,-4H491.33m0,-4v8" style="vector-effect: none; stroke-width: 2px; stroke: rgb(42, 63, 95); stroke-opacity: 1;"/></g><g class="errorbar" style="opacity: 1;"><path class="xerror" d="M25.32,17v8m0,-4H24.56m0,-4v8" style="vector-effect: none; stroke-width: 2px; stroke: rgb(42, 63, 95); stroke-opacity: 1;"/></g></g><g class="trace bars" style="opacity: 1;"><g class="points"><g class="point"><path d="M0,345V333H52.71V345Z" style="vector-effect: none; opacity: 1; stroke-width: 0.5px; fill: rgb(179, 205, 227); fill-opacity: 1; stroke: rgb(255, 255, 255); stroke-opacity: 1;"/></g><g class="point"><path d="M0,315V303H51.34V315Z" style="vector-effect: none; opacity: 1; stroke-width: 0.5px; fill: rgb(179, 205, 227); fill-opacity: 1; stroke: rgb(255, 255, 255); stroke-opacity: 1;"/></g><g class="point"><path d="M0,285V273H52.05V285Z" style="vector-effect: none; opacity: 1; stroke-width: 0.5px; fill: rgb(179, 205, 227); fill-opacity: 1; stroke: rgb(255, 255, 255); stroke-opacity: 1;"/></g><g class="point"><path d="M0,255V243H0.01V255Z" style="vector-effect: none; opacity: 1; stroke-width: 0.5px; fill: rgb(179, 205, 227); fill-opacity: 1; stroke: rgb(255, 255, 255); stroke-opacity: 1;"/></g><g class="point"><path d="M0,225V213H35.31V225Z" style="vector-effect: none; opacity: 1; stroke-width: 0.5px; fill: rgb(179, 205, 227); fill-opacity: 1; stroke: rgb(255, 255, 255); stroke-opacity: 1;"/></g><g class="point"><path d="M0,195V183H463.36V195Z" style="vector-effect: none; opacity: 1; stroke-width: 0.5px; fill: rgb(179, 205, 227); fill-opacity: 1; stroke: rgb(255, 255, 255); stroke-opacity: 1;"/></g><g class="point"><path d="M0,165V153H463.38V165Z" style="vector-effect: none; opacity: 1; stroke-width: 0.5px; fill: rgb(179, 205, 227); fill-opacity: 1; stroke: rgb(255, 255, 255); stroke-opacity: 1;"/></g><g class="point"><path d="M0,135V123H453.9V135Z" style="vector-effect: none; opacity: 1; stroke-width: 0.5px; fill: rgb(179, 205, 227); fill-opacity: 1; stroke: rgb(255, 255, 255); stroke-opacity: 1;"/></g><g class="point"><path d="M0,105V93H451.87V105Z" style="vector-effect: none; opacity: 1; stroke-width: 0.5px; fill: rgb(179, 205, 227); fill-opacity: 1; stroke: rgb(255, 255, 255); stroke-opacity: 1;"/></g><g class="point"><path d="M0,75V63H220.33V75Z" style="vector-effect: none; opacity: 1; stroke-width: 0.5px; fill: rgb(179, 205, 227); fill-opacity: 1; stroke: rgb(255, 255, 255); stroke-opacity: 1;"/></g><g class="point"><path d="M0,45V33H465.09V45Z" style="vector-effect: none; opacity: 1; stroke-width: 0.5px; fill: rgb(179, 205, 227); fill-opacity: 1; stroke: rgb(255, 255, 255); stroke-opacity: 1;"/></g><g class="point"><path d="M0,15V3H449.14V15Z" style="vector-effect: none; opacity: 1; stroke-width: 0.5px; fill: rgb(179, 205, 227); fill-opacity: 1; stroke: rgb(255, 255, 255); stroke-opacity: 1;"/></g></g><g class="errorbar" style="opacity: 1;"><path class="xerror" d="M57.61,335v8m0,-4H49.86m0,-4v8" style="vector-effect: none; stroke-width: 2px; stroke: rgb(42, 63, 95); stroke-opacity: 1;"/></g><g class="errorbar" style="opacity: 1;"><path class="xerror" d="M56.04,305v8m0,-4H46.9m0,-4v8" style="vector-effect: none; stroke-width: 2px; stroke: rgb(42, 63, 95); stroke-opacity: 1;"/></g><g class="errorbar" style="opacity: 1;"><path class="xerror" d="M58.53,275v8m0,-4H49.23m0,-4v8" style="vector-effect: none; stroke-width: 2px; stroke: rgb(42, 63, 95); stroke-opacity: 1;"/></g><g class="errorbar" style="opacity: 1;"><path class="xerror" d="M0.01,245v8m0,-4H0.01m0,-4v8" style="vector-effect: none; stroke-width: 2px; stroke: rgb(42, 63, 95); stroke-opacity: 1;"/></g><g class="errorbar" style="opacity: 1;"><path class="xerror" d="M36.86,215v8m0,-4H33.94m0,-4v8" style="vector-effect: none; stroke-width: 2px; stroke: rgb(42, 63, 95); stroke-opacity: 1;"/></g><g class="errorbar" style="opacity: 1;"><path class="xerror" d="M487.27,185v8m0,-4H451.32m0,-4v8" style="vector-effect: none; stroke-width: 2px; stroke: rgb(42, 63, 95); stroke-opacity: 1;"/></g><g class="errorbar" style="opacity: 1;"><path class="xerror" d="M489.13,155v8m0,-4H452.13m0,-4v8" style="vector-effect: none; stroke-width: 2px; stroke: rgb(42, 63, 95); stroke-opacity: 1;"/></g><g class="errorbar" style="opacity: 1;"><path class="xerror" d="M479.14,125v8m0,-4H418.47m0,-4v8" style="vector-effect: none; stroke-width: 2px; stroke: rgb(42, 63, 95); stroke-opacity: 1;"/></g><g class="errorbar" style="opacity: 1;"><path class="xerror" d="M498.2,95v8m0,-4H410.64m0,-4v8" style="vector-effect: none; stroke-width: 2px; stroke: rgb(42, 63, 95); stroke-opacity: 1;"/></g><g class="errorbar" style="opacity: 1;"><path class="xerror" d="M229.28,65v8m0,-4H217.36m0,-4v8" style="vector-effect: none; stroke-width: 2px; stroke: rgb(42, 63, 95); stroke-opacity: 1;"/></g><g class="errorbar" style="opacity: 1;"><path class="xerror" d="M505.64,35v8m0,-4H444.72m0,-4v8" style="vector-effect: none; stroke-width: 2px; stroke: rgb(42, 63, 95); stroke-opacity: 1;"/></g><g class="errorbar" style="opacity: 1;"><path class="xerror" d="M478.51,5v8m0,-4H432.16m0,-4v8" style="vector-effect: none; stroke-width: 2px; stroke: rgb(42, 63, 95); stroke-opacity: 1;"/></g></g></g></g><g class="overplot"/><path class="xlines-above crisp" style="fill: none;" d="M0,0"/><path class="ylines-above crisp" style="fill: none;" d="M0,0"/><g class="overlines-above"/><g class="xaxislayer-above"><g class="xtick"><text text-anchor="middle" x="0" y="433" transform="translate(299,0)" style="font-family: 'Open Sans', verdana, arial, sans-serif; font-size: 12px; fill: rgb(42, 63, 95); fill-opacity: 1; white-space: pre; opacity: 1;">0</text></g><g class="xtick"><text text-anchor="middle" x="0" y="433" style="font-family: 'Open Sans', verdana, arial, sans-serif; font-size: 12px; fill: rgb(42, 63, 95); fill-opacity: 1; white-space: pre; opacity: 1;" transform="translate(413.97,0)">100k</text></g><g class="xtick"><text text-anchor="middle" x="0" y="433" style="font-family: 'Open Sans', verdana, arial, sans-serif; font-size: 12px; fill: rgb(42, 63, 95); fill-opacity: 1; white-space: pre; opacity: 1;" transform="translate(528.94,0)">200k</text></g><g class="xtick"><text text-anchor="middle" x="0" y="433" style="font-family: 'Open Sans', verdana, arial, sans-serif; font-size: 12px; fill: rgb(42, 63, 95); fill-opacity: 1; white-space: pre; opacity: 1;" transform="translate(643.9100000000001,0)">300k</text></g><g class="xtick"><text text-anchor="middle" x="0" y="433" style="font-family: 'Open Sans', verdana, arial, sans-serif; font-size: 12px; fill: rgb(42, 63, 95); fill-opacity: 1; white-space: pre; opacity: 1;" transform="translate(758.87,0)">400k</text></g><g class="xtick"><text text-anchor="middle" x="0" y="433" style="font-family: 'Open Sans', verdana, arial, sans-serif; font-size: 12px; fill: rgb(42, 63, 95); fill-opacity: 1; white-space: pre; opacity: 1;" transform="translate(873.84,0)">500k</text></g></g><g class="yaxislayer-above"><g class="ytick"><text text-anchor="end" x="298" y="4.199999999999999" transform="translate(0,405)" style="font-family: 'Open Sans', verdana, arial, sans-serif; font-size: 12px; fill: rgb(42, 63, 95); fill-opacity: 1; white-space: pre; opacity: 1;">bench11_listOptimizedForeachArgInlined</text></g><g class="ytick"><text text-anchor="end" x="298" y="4.199999999999999" transform="translate(0,375)" style="font-family: 'Open Sans', verdana, arial, sans-serif; font-size: 12px; fill: rgb(42, 63, 95); fill-opacity: 1; white-space: pre; opacity: 1;">bench10_listOptimizedForeach</text></g><g class="ytick"><text text-anchor="end" x="298" y="4.199999999999999" transform="translate(0,345)" style="font-family: 'Open Sans', verdana, arial, sans-serif; font-size: 12px; fill: rgb(42, 63, 95); fill-opacity: 1; white-space: pre; opacity: 1;">bench09_listForLoop</text></g><g class="ytick"><text text-anchor="end" x="298" y="4.199999999999999" transform="translate(0,315)" style="font-family: 'Open Sans', verdana, arial, sans-serif; font-size: 12px; fill: rgb(42, 63, 95); fill-opacity: 1; white-space: pre; opacity: 1;">bench08_listForLoopIndex</text></g><g class="ytick"><text text-anchor="end" x="298" y="4.199999999999999" transform="translate(0,285)" style="font-family: 'Open Sans', verdana, arial, sans-serif; font-size: 12px; fill: rgb(42, 63, 95); fill-opacity: 1; white-space: pre; opacity: 1;">bench07_listSumMethod</text></g><g class="ytick"><text text-anchor="end" x="298" y="4.199999999999999" transform="translate(0,255)" style="font-family: 'Open Sans', verdana, arial, sans-serif; font-size: 12px; fill: rgb(42, 63, 95); fill-opacity: 1; white-space: pre; opacity: 1;">bench06_arrayOptimizedForeachArgInlined</text></g><g class="ytick"><text text-anchor="end" x="298" y="4.199999999999999" transform="translate(0,225)" style="font-family: 'Open Sans', verdana, arial, sans-serif; font-size: 12px; fill: rgb(42, 63, 95); fill-opacity: 1; white-space: pre; opacity: 1;">bench05_arrayOptimizedForeach</text></g><g class="ytick"><text text-anchor="end" x="298" y="4.199999999999999" transform="translate(0,195)" style="font-family: 'Open Sans', verdana, arial, sans-serif; font-size: 12px; fill: rgb(42, 63, 95); fill-opacity: 1; white-space: pre; opacity: 1;">bench04_arrayForLoop</text></g><g class="ytick"><text text-anchor="end" x="298" y="4.199999999999999" transform="translate(0,165)" style="font-family: 'Open Sans', verdana, arial, sans-serif; font-size: 12px; fill: rgb(42, 63, 95); fill-opacity: 1; white-space: pre; opacity: 1;">bench03_arrayOptimizedForLoopIndex</text></g><g class="ytick"><text text-anchor="end" x="298" y="4.199999999999999" transform="translate(0,135)" style="font-family: 'Open Sans', verdana, arial, sans-serif; font-size: 12px; fill: rgb(42, 63, 95); fill-opacity: 1; white-space: pre; opacity: 1;">bench02_arrayForLoopIndex</text></g><g class="ytick"><text text-anchor="end" x="298" y="4.199999999999999" transform="translate(0,105)" style="font-family: 'Open Sans', verdana, arial, sans-serif; font-size: 12px; fill: rgb(42, 63, 95); fill-opacity: 1; white-space: pre; opacity: 1;">bench01_arrayWhileLoopIndex</text></g><g class="ytick"><text text-anchor="end" x="298" y="4.199999999999999" transform="translate(0,75)" style="font-family: 'Open Sans', verdana, arial, sans-serif; font-size: 12px; fill: rgb(42, 63, 95); fill-opacity: 1; white-space: pre; opacity: 1;">bench00_arraySumMethod</text></g></g><g class="overaxes-above"/></g></g><g class="polarlayer"/><g class="smithlayer"/><g class="ternarylayer"/><g class="geolayer"/><g class="funnelarealayer"/><g class="pielayer"/><g class="iciclelayer"/><g class="treemaplayer"/><g class="sunburstlayer"/><g class="glimages"/><defs id="topdefs-e63d07"><g class="clips"/><clipPath id="legende63d07"><rect width="94" height="67" x="0" y="0"/></clipPath></defs><g class="layer-above"><g class="imagelayer"/><g class="shapelayer"/></g><g class="infolayer"><g class="legend" pointer-events="all" transform="translate(893.66,60)"><rect class="bg" shape-rendering="crispEdges" style="stroke: rgb(68, 68, 68); stroke-opacity: 1; fill: rgb(255, 255, 255); fill-opacity: 1; stroke-width: 0px;" width="94" height="67" x="0" y="0"/><g class="scrollbox" transform="" clip-path="url(#legende63d07)"><text class="legendtitletext" text-anchor="start" x="2" y="18.2" style="font-family: 'Open Sans', verdana, arial, sans-serif; font-size: 14px; fill: rgb(42, 63, 95); fill-opacity: 1; white-space: pre;">jvm</text><g class="groups" transform=""><g class="traces" transform="translate(0,32.7)" style="opacity: 1;"><text class="legendtext" text-anchor="start" x="40" y="4.680000000000001" style="font-family: 'Open Sans', verdana, arial, sans-serif; font-size: 12px; fill: rgb(42, 63, 95); fill-opacity: 1; white-space: pre;">openjdk</text><g class="layers" style="opacity: 1;"><g class="legendfill"/><g class="legendlines"/><g class="legendsymbols"><g class="legendpoints"><path class="legendundefined" d="M6,6H-6V-6H6Z" transform="translate(20,0)" style="stroke-width: 0.5px; fill: rgb(251, 180, 174); fill-opacity: 1; stroke: rgb(255, 255, 255); stroke-opacity: 1;"/></g></g></g><rect class="legendtoggle" x="0" y="-9.5" width="88.21875" height="19" style="fill: rgb(0, 0, 0); fill-opacity: 0;"/></g></g><g class="groups" transform=""><g class="traces" transform="translate(0,51.7)" style="opacity: 1;"><text class="legendtext" text-anchor="start" x="40" y="4.680000000000001" style="font-family: 'Open Sans', verdana, arial, sans-serif; font-size: 12px; fill: rgb(42, 63, 95); fill-opacity: 1; white-space: pre;">graal</text><g class="layers" style="opacity: 1;"><g class="legendfill"/><g class="legendlines"/><g class="legendsymbols"><g class="legendpoints"><path class="legendundefined" d="M6,6H-6V-6H6Z" transform="translate(20,0)" style="stroke-width: 0.5px; fill: rgb(179, 205, 227); fill-opacity: 1; stroke: rgb(255, 255, 255); stroke-opacity: 1;"/></g></g></g><rect class="legendtoggle" x="0" y="-9.5" width="88.21875" height="19" style="fill: rgb(0, 0, 0); fill-opacity: 0;"/></g></g></g><rect class="scrollbar" rx="20" ry="3" width="0" height="0" style="fill: rgb(128, 139, 164); fill-opacity: 1;" x="0" y="0"/></g><g class="g-gtitle"><text class="gtitle" x="50" y="30" text-anchor="start" dy="0em" style="font-family: 'Open Sans', verdana, arial, sans-serif; font-size: 17px; fill: rgb(42, 63, 95); opacity: 1; font-weight: normal; white-space: pre;">SumBenchmark</text></g><g class="g-xtitle"><text class="xtitle" x="590.5" y="459.8" text-anchor="middle" style="font-family: 'Open Sans', verdana, arial, sans-serif; font-size: 14px; fill: rgb(42, 63, 95); opacity: 1; font-weight: normal; white-space: pre;">Throughput [ops/s] (higher is better)</text></g><g class="g-ytitle" transform="translate(1.6123046875,0)"><text class="ytitle" transform="rotate(-90,12.387499999999989,240)" x="12.387499999999989" y="240" text-anchor="middle" style="font-family: 'Open Sans', verdana, arial, sans-serif; font-size: 14px; fill: rgb(42, 63, 95); opacity: 1; font-weight: normal; white-space: pre;">Benchmark</text></g></g></svg>
\ No newline at end of file
name := "cs206-demos"
version := "0.1.2"
scalaVersion := "3.2.0"
scalaVersion := "3.2.2"
val akkaVersion = "2.8.2"
val logbackVersion = "1.2.11"
libraryDependencies ++= Seq(
("com.storm-enroute" %% "scalameter-core" % "0.21").cross(CrossVersion.for3Use2_13),
"org.scala-lang.modules" %% "scala-parallel-collections" % "1.0.4",
"org.scalameta" %% "munit" % "1.0.0-M7" % Test,
"junit" % "junit" % "4.13" % Test,
"com.github.sbt" % "junit-interface" % "0.13.3" % Test,
"com.typesafe.akka" %% "akka-actor" % akkaVersion,
"com.typesafe.akka" %% "akka-testkit" % akkaVersion,
// SLF4J backend
// See https://doc.akka.io/docs/akka/current/typed/logging.html#slf4j-backend
"ch.qos.logback" % "logback-classic" % logbackVersion
)
scalacOptions ++= Seq("-unchecked", "-deprecation")
// Enable debug logging for akka
//javaOptions ++= Seq("-Dakka.loglevel=Debug", "-Dakka.actor.debug.receive=on")
Test / fork := true
Test / parallelExecution := false
Test / testOptions += Tests.Argument(TestFrameworks.JUnit)
......
sbt.version=1.7.1
sbt.version=1.8.3
package concpar20final03
import scala.concurrent.{Await, Future}
import scala.concurrent.duration.Duration
import scala.concurrent.ExecutionContext.Implicits.global
import scala.util.{Failure, Success}
def sequence1[A](fs: List[Future[A]]): Future[List[A]] =
fs match
case f :: fs =>
for
x <- f
xs <- sequence1(fs)
yield x :: xs
case Nil =>
Future.successful(Nil)
def sequence2[A](fs: List[Future[A]]): Future[List[A]] =
fs match
case f :: fs =>
f.flatMap(x => sequence2(fs).map(xs => x :: xs))
case Nil =>
Future.successful(Nil)
def sequence3[A](fs: List[Future[A]]): Future[List[A]] =
fs match
case f :: fs =>
f.transformWith {
case Failure(e) => Future.failed(e)
case Success(value) =>
sequence3(fs).transform {
case res: Failure[List[A]] => res
case Success(values) => Success(value :: values)
}
}
case Nil =>
Future.successful(Nil)
def sequence4[A](fs: List[Future[A]]): Future[List[A]] =
fs match
case f :: fs =>
val fsFuture: Future[List[A]] = sequence4(fs)
f.zip(fsFuture).map((fValue, fsValue) => fValue :: fsValue)
case Nil =>
Future.successful(Nil)
@main def concpar20final03 =
val xs = List(Future { 1 }, Future { 2 }, Future { 3 })
val ys = List(Future { 1 }, Future.failed(Error("BOOM")), Future { 3 })
println(Await.result(sequence1(xs), Duration.Inf))
// println(Await.result(sequence1(xs), Duration.Inf)) // Throws exception
println(Await.result(sequence2(xs), Duration.Inf))
// println(Await.result(sequence2(ys), Duration.Inf)) // Throws exception
println(Await.result(sequence3(xs), Duration.Inf))
// println(Await.result(sequence3(ys), Duration.Inf)) // Throws exception
println(Await.result(sequence4(xs), Duration.Inf))
// println(Await.result(sequence4(ys), Duration.Inf)) // Throws exception
package concpar21final01
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.Future
case class Grade(sciper: Int, grade: Double)
trait Problem1:
/** Retrieve the list of student grades, sorted such that maximum grades
* appear at the head of the list.
*/
def leaderboard(): Future[List[Grade]] =
getScipers()
.flatMap { scipers =>
Future.sequence(scipers.map(getGrade))
}
.map(_.flatten.sortBy(_.grade).reverse)
/** Retrieve a student's grade using GitLab's API. The result is wrapped in an
* option, where `Future(None)` indicates either:
* - the student is not registered to the class
* - the student did not push his/her solution to GitLab
*/
def getGrade(sciper: Int): Future[Option[Grade]]
/** Retrieve the list of enrolled students from IS-academia
*/
def getScipers(): Future[List[Int]]
package concpar21final01
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.Future
import scala.util.Random
class Problem1MockData extends Problem1:
def getGrade(sciper: Int): Future[Option[Grade]] =
Future {
// In an actual implementation, this is where we would make a call to
// the GitLab APIs. This mock returns a random grade after a short delay.
Thread.sleep(15) // GitLab is pretty fast today...
val rand = new Random(sciper)
val grade = rand.nextInt(6).toDouble + rand.nextDouble()
if sciper < 100000 || sciper > 999999 || sciper % 10 == 0 then None
else Some(Grade(sciper, grade))
}
/** Retrieve the list of enrolled students from IS-academia
*/
def getScipers(): Future[List[Int]] =
Future {
Thread.sleep(100)
List( // A fake list of SCIPER numbers
301425, 207372, 320658, 300217, 224523, 301068, 331020, 331095, 320270,
320742, 299310, 300974, 322202, 343357, 302632, 343366, 320229, 269364,
320004, 321830, 219188, 300834, 320992, 299237, 298016, 300397, 269857,
300492, 300481, 279254, 320967, 300443, 300329, 300305, 331158, 310402,
279067, 300682, 259825, 351616, 310869, 301215, 299481, 269375, 351249,
310866, 351141, 301530, 361378, 351661, 351524, 311081, 331137, 332319,
301045, 300393, 300308, 310889, 310064, 310841, 351333, 310382, 333887,
333837, 320832, 321397, 351691, 269125, 312732, 351546, 301783, 351698,
310775, 331388, 311139, 301992, 301578, 361760, 351174, 310298, 300666,
259778, 301554, 301278, 301669, 321372, 311347, 321129, 351490, 321189,
301336, 341560, 331220, 331129, 333927, 279186, 310596, 299135, 279226,
310507, 269049, 300309, 341524, 351143, 300785, 310612, 320338, 259980,
269952, 310397, 320246, 310959, 301454, 301835, 301802, 301649, 301170,
301908, 351708, 321046, 361490, 311070, 351830, 311054, 311912, 301913,
361232, 301030, 351723, 311472, 311166, 321057, 310793, 269462, 311948,
321693, 321056, 361765, 301453, 321626, 341490, 320892, 269871, 269580,
320199, 320908, 320830, 269071, 380542, 253768, 311204, 269127, 351073,
341327, 301792, 299789, 361424, 301525, 311637, 321423, 279111, 330126,
310371, 259888, 269525, 299585, 300147, 341402, 330067, 311796, 279037,
248517, 301436, 269965, 259963, 320720, 248583, 259709, 361204, 341500,
311803, 299981, 311832, 301088, 259649, 279183, 341760, 311844, 279079,
390997, 311917, 390999, 361122, 301208, 311538, 272943, 361570, 390959)
}
package concpar21final02
import akka.actor.*
import scala.collection.mutable
import akka.testkit.*
object Problem2:
//////////////////////////////
// NOTIFICATION SERVICE //
//////////////////////////////
object NotificationService:
enum Protocol:
/** Notify all registered actors */
case NotifyAll
/** Register the actor that sent the `Register` request */
case Register //
/** Un-register the actor that sent the `Register` request */
case UnRegister
enum Responses:
/** Message sent to an actor when it is notified */
case Notification
/** Response sent to an actor after a `Register` or `UnRegister` */
case Registered(registered: Boolean)
class NotificationService extends Actor:
import NotificationService.Protocol.*
import NotificationService.Responses.*
private val registeredUsers = mutable.Set.empty[ActorRef]
def receive: Receive = {
case Register =>
registeredUsers += sender()
sender() ! Registered(true)
case UnRegister =>
registeredUsers -= sender()
sender() ! Registered(false)
case NotifyAll =>
for user <- registeredUsers do user ! Notification
}
/////////////////////////
// DISCORD CHANNEL //
/////////////////////////
object DiscordChannel:
enum Protocol:
/** Post a message in the channel */
case Post(msg: String)
/** Ask for the list of most recent posts starting from the most recent
* one. The list must have at most `limit` posts.
*/
case GetLastPosts(limit: Int)
/** Activates the service channel using the provided notification service.
*/
case Init(notificationService: ActorRef)
enum Responses:
/** Response to `GetLastPosts` if active */
case Posts(msgs: List[String])
/** Response after `Init` if non-active */
case Active
/** Response `Post` and `GetLastPosts` if non-active */
case NotActive
/** Response after `Init` if active */
case AlreadyActive
class DiscordChannel extends Actor:
import DiscordChannel.Protocol.*
import DiscordChannel.Responses.*
import NotificationService.Protocol.*
private var messages: List[String] = Nil
def receive: Receive = nonActive
def nonActive: Receive = {
case Init(service) =>
context.become(active(service))
sender() ! Active
case Post(_) | GetLastPosts(_) =>
sender() ! NotActive
}
def active(notificationService: ActorRef): Receive = {
case Post(msg) =>
messages = msg :: messages
notificationService ! NotifyAll
case GetLastPosts(limit) =>
sender() ! Posts(messages.take(limit))
case Init(_) =>
sender() ! AlreadyActive
}
/////////////////////////
// DEBUG //
/////////////////////////
/** Infrastructure to help debugging. In sbt use `run` to execute this code. The
* TestKit is an actor that can send messages and check the messages it
* receives (or not).
*/
@main def debug() = new TestKit(ActorSystem("DebugSystem")) with ImplicitSender:
import Problem2.*
import DiscordChannel.Protocol.*
import DiscordChannel.Responses.*
import NotificationService.Protocol.*
import NotificationService.Responses.*
import concurrent.duration.*
try
val notificationService = system.actorOf(Props[NotificationService]())
val channel = system.actorOf(Props[DiscordChannel]())
notificationService ! NotifyAll
expectNoMessage(
200.millis
) // expects no message is received in the next 200 milliseconds
notificationService ! Register
expectMsg(
200.millis,
Registered(true)
) // expects to receive `Registered(true)` in the next 200 milliseconds
finally shutdown(system)
package concpar21final03
import instrumentation.*
import scala.collection.mutable
import scala.collection.concurrent.TrieMap
type FileName = String
/** An API for manipulating files. */
trait FileSystem:
/** Create a new file named `file` with the passed `content`. */
def createFile(file: FileName, content: String): Unit
/** If `file` exists, return its content, otherwise crashes. */
def readFile(file: FileName): String
/** If `file` exists, delete it, otherwise crash. */
def deleteFile(file: FileName): Unit
end FileSystem
/** An in-memory file system for testing purposes implemented using a Map.
*
* Every method in this class is thread-safe.
*/
class InMemoryFileSystem extends FileSystem:
val fsMap: mutable.Map[FileName, String] = TrieMap()
def createFile(file: FileName, content: String): Unit =
assert(!fsMap.contains(file), s"$file already exists")
fsMap(file) = content
def readFile(file: FileName): String =
fsMap.get(file) match
case Some(content) => content
case None => assert(false, s"Attempt to read non-existing $file")
def deleteFile(file: FileName): Unit =
fsMap.remove(file)
end InMemoryFileSystem