Skip to content

Commit

Permalink
Merge pull request #242 from renaissance-benchmarks/topic/update-scal…
Browse files Browse the repository at this point in the history
…a-sbt

Update benchmarks to use Scala 2.12 or 2.13 (and handle most of the resulting fallout)
  • Loading branch information
lbulej authored Apr 27, 2021
2 parents 23c09f8 + ddf9fcd commit 8e3f720
Show file tree
Hide file tree
Showing 656 changed files with 138,137 additions and 4,956 deletions.
8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
target
.idea
target/
.bsp/
.idea/
*.cfg
*.iml
tools/sbt/lib/local-preloaded/

# Scratch directories
harness-*/
launcher-*/
3 changes: 2 additions & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ docstrings = JavaDoc
continuationIndent.callSite = 2
continuationIndent.defnSite = 2
continuationIndent.extendSite = 2
align = none
align.preset = none
align.openParenCallSite = false
align.openParenDefnSite = false
optIn.configStyleArguments = true
newlines.alwaysBeforeTopLevelStatements = true
rewrite.rules = [
SortModifiers
Expand Down
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ refs:
# Test benchmarks under Renaissance harness
- 'java -jar ./target/renaissance-gpl-$RENAISSANCE_VERSION.jar --raw-list >list.txt'
- 'for BENCH in $(cat list.txt); do echo "====> $BENCH"; java -Xms2500M -Xmx2500M -jar ./target/renaissance-gpl-$RENAISSANCE_VERSION.jar -c test -r 1 --csv output.csv --json output.json "$BENCH" || exit 1; done'
# Test benchmarks under JMH harness
- 'java -Xms2500M -Xmx2500M -jar ./renaissance-jmh/target/scala-2.12/renaissance-jmh-assembly-$RENAISSANCE_VERSION.jar -wi 0 -i 1 -f 1 -foe true'
# Test benchmarks under JMH harness, replacing incompatible benchmarks with 'dummy-empty'
- 'java -Xms2500M -Xmx2500M -Dorg.renaissance.jmh.fakeIncompatible=true -jar ./renaissance-jmh/target/scala-2.12/renaissance-jmh-assembly-$RENAISSANCE_VERSION.jar -wi 0 -i 1 -f 1 -foe true'

jobs:
include:
Expand Down
87 changes: 43 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,19 @@ Usage: renaissance [options] [benchmark-specification]
--plugin <class-path>!<class-name>
Load external plugin. Can appear multiple times.
--with-arg <value> Adds an argument to the plugin or policy specified last. Can appear multiple times.
--csv <file-path> Output results to CSV file.
--json <file-path> Output results to JSON file.
-c, --configuration <name>
Run benchmarks with given named configuration.
--no-forced-gc Do not force garbage collection before each measured operation.
--list Print list of benchmarks with their description.
--raw-list Print list of benchmarks (each benchmark name on separate line).
--group-list Print list of benchmark groups (each group name on separate line).
benchmark-specification Comma-separated list of benchmarks (or groups) that must be executed (or all).
--csv <csv-file> Output results as CSV to <csv-file>.
--json <json-file> Output results as JSON to <json-file>.
-c, --configuration <conf-name>
Use benchmark parameters from configuration <conf-name>.
--scratch-base <dir> Create scratch directories in <dir>. Defaults to current directory.
--keep-scratch Keep the scratch directories after VM exit. Defaults to deleting scratch directories.
--no-forced-gc Do not force garbage collection before each measured operation. Defaults to forced GC.
--no-jvm-check Do not check benchmark JVM version requirements (for execution or raw-list).
--list Print the names and descriptions of all benchmarks.
--raw-list Print the names of benchmarks compatible with this JVM (one per line).
--group-list Print the names of all benchmark groups (one per line).
benchmark-specification List of benchmarks (or groups) to execute (or 'all').
```


Expand Down Expand Up @@ -314,41 +318,36 @@ while the MIT distribution includes only those benchmarks that themselves
have less restrictive licenses.

Depending on your needs, you can use either of the two distributions.
The following table contains the licensing information of all the benchmarks:

| Benchmark | Licenses | Renaissance Distro |
| ------------- | ------------- |:------------------:|
| akka-uct | MIT | MIT |
| als | APACHE2 | MIT |
| chi-square | APACHE2 | MIT |
| db-shootout | APACHE2 | MIT |
| dec-tree | APACHE2 | MIT |
| dotty | BSD3 | MIT |
| dummy-empty | MIT | MIT |
| dummy-failing | MIT | MIT |
| dummy-param | MIT | MIT |
| dummy-setup-failing | MIT | MIT |
| dummy-teardown-failing | MIT | MIT |
| dummy-validation-failing | MIT | MIT |
| finagle-chirper | APACHE2 | MIT |
| finagle-http | APACHE2 | MIT |
| fj-kmeans | APACHE2 | MIT |
| future-genetic | APACHE2 | MIT |
| gauss-mix | APACHE2 | MIT |
| log-regression | APACHE2 | MIT |
| mnemonics | MIT | MIT |
| movie-lens | APACHE2 | MIT |
| naive-bayes | APACHE2 | MIT |
| neo4j-analytics | GPL3 | GPL3 |
| page-rank | APACHE2 | MIT |
| par-mnemonics | MIT | MIT |
| philosophers | BSD3 | MIT |
| reactors | MIT | MIT |
| rx-scrabble | GPL2 | GPL3 |
| scala-doku | MIT | MIT |
| scala-kmeans | MIT | MIT |
| scala-stm-bench7 | BSD3, GPL2 | GPL3 |
| scrabble | GPL2 | GPL3 |
The following table contains the licensing information (and JVM version
requirements) for all the benchmarks:

| Benchmark | Licenses | Distro | JVM required (min) | JVM supported (max) |
| :--------------- | :--------- | :----: | :----------------: | :-----------------: |
| akka-uct | MIT | MIT | 1.8 | |
| als | APACHE2 | MIT | 1.8 | |
| chi-square | APACHE2 | MIT | 1.8 | |
| db-shootout | APACHE2 | MIT | 1.8 | |
| dec-tree | APACHE2 | MIT | 1.8 | |
| dotty | BSD3 | MIT | 1.8 | |
| finagle-chirper | APACHE2 | MIT | 1.8 | |
| finagle-http | APACHE2 | MIT | 1.8 | |
| fj-kmeans | APACHE2 | MIT | 1.8 | |
| future-genetic | APACHE2 | MIT | 1.8 | |
| gauss-mix | APACHE2 | MIT | 1.8 | |
| log-regression | APACHE2 | MIT | 1.8 | |
| mnemonics | MIT | MIT | 1.8 | |
| movie-lens | APACHE2 | MIT | 1.8 | |
| naive-bayes | APACHE2 | MIT | 1.8 | |
| neo4j-analytics | GPL3 | GPL3 | 11 | 15 |
| page-rank | APACHE2 | MIT | 1.8 | |
| par-mnemonics | MIT | MIT | 1.8 | |
| philosophers | BSD3 | MIT | 1.8 | |
| reactors | MIT | MIT | 1.8 | |
| rx-scrabble | GPL2 | GPL3 | 1.8 | |
| scala-doku | MIT | MIT | 1.8 | |
| scala-kmeans | MIT | MIT | 1.8 | |
| scala-stm-bench7 | BSD3, GPL2 | GPL3 | 1.8 | |
| scrabble | GPL2 | GPL3 | 1.8 | |


### Design overview
Expand Down
1 change: 1 addition & 0 deletions benchmarks/actors-akka/.scalafmt.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include "../../.scalafmt.conf"
11 changes: 5 additions & 6 deletions benchmarks/actors/build.sbt → benchmarks/actors-akka/build.sbt
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
lazy val renaissanceCore = RootProject(uri("../../renaissance-core"))

lazy val actors = (project in file("."))
lazy val actorsAkka = (project in file("."))
.settings(
name := "actors",
name := "actors-akka",
version := (version in renaissanceCore).value,
organization := (organization in renaissanceCore).value,
scalafmtConfig := Some(file(".scalafmt.conf")),
scalaVersion := "2.11.8",
scalaVersion := "2.13.5",
libraryDependencies ++= Seq(
"com.typesafe.akka" %% "akka-actor" % "2.3.11",
"io.reactors" %% "reactors-core" % "0.7"
// akka-actor 2.6.x supports Scala 2.12, 2.13
"com.typesafe.akka" %% "akka-actor" % "2.6.12"
)
)
.dependsOn(
Expand Down
1 change: 1 addition & 0 deletions benchmarks/actors-akka/project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.2")
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public final String name() {

public final String runtimeInfo() {
final String javaVersion = System.getProperty("java.version");
return "Java:" + javaVersion + "::Scala:2.11.0";
return "Java:" + javaVersion + "::Scala:2.13.4";
}

public abstract void initialize(String[] args) throws IOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import scala.util.Properties._
import scala.util.{Failure, Success}

/**
*
* @author <a href="http://shams.web.rice.edu/">Shams Imam</a> ([email protected])
*/
abstract class AkkaActor[MsgType] extends Actor {
Expand Down Expand Up @@ -105,20 +104,23 @@ object AkkaActorState {
object actorLatch {
private var count = 0

def countDown(): Unit = this.synchronized {
count -= 1
if (count == 0) this.notifyAll()
}
def countDown(): Unit =
this.synchronized {
count -= 1
if (count == 0) this.notifyAll()
}

def countUp(): Unit = this.synchronized {
count += 1
}
def countUp(): Unit =
this.synchronized {
count += 1
}

def await(): Unit = this.synchronized {
while (count != 0) {
this.wait()
def await(): Unit =
this.synchronized {
while (count != 0) {
this.wait()
}
}
}
}

private val mailboxTypeKey = "actors.mailboxType"
Expand Down Expand Up @@ -214,7 +216,7 @@ object AkkaActorState {
def awaitTermination(system: ActorSystem) {
try {
actorLatch.await()
system.shutdown()
system.terminate()
} catch {
case ex: InterruptedException => {
ex.printStackTrace()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,19 @@ import org.renaissance.License
@Licenses(Array(License.MIT))
@Repetitions(24)
@Parameter(name = "loop_count", defaultValue = "10")
// Work around @Repeatable annotations not working in this Scala version.
@Configurations(
Array(
new Configuration(name = "test", settings = Array("loop_count = 2")),
new Configuration(name = "jmh", settings = Array("loop_count = 1"))
)
)
@Configuration(name = "test", settings = Array("loop_count = 2"))
@Configuration(name = "jmh", settings = Array("loop_count = 1"))
final class AkkaUct extends Benchmark {

// TODO: Consolidate benchmark parameters across the suite.
// See: https://github.com/renaissance-benchmarks/renaissance/issues/27

private var loopCountParam: Int = _

private var bench: UctAkkaActorBenchmark.UctAkkaActorBenchmark = null
private var bench: UctAkkaActorBenchmark.UctAkkaActorBenchmark = _

override def setUpBeforeAll(c: BenchmarkContext): Unit = {
loopCountParam = c.intParameter("loop_count")
loopCountParam = c.parameter("loop_count").toPositiveInteger

bench = new UctAkkaActorBenchmark.UctAkkaActorBenchmark
bench.initialize(new Array[String](0))
Expand All @@ -41,12 +36,12 @@ final class AkkaUct extends Benchmark {

override def tearDownAfterAll(c: BenchmarkContext): Unit = {
if (bench != null) {
bench.cleanupIteration(false, 0)
bench.cleanupIteration(lastIteration = false, 0)
}
}

override def run(c: BenchmarkContext): BenchmarkResult = {
for (i <- 0 until loopCountParam) {
for (_ <- 0 until loopCountParam) {
bench.runIteration()
}

Expand Down
1 change: 1 addition & 0 deletions benchmarks/actors-reactors/.scalafmt.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include "../../.scalafmt.conf"
17 changes: 17 additions & 0 deletions benchmarks/actors-reactors/build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
lazy val renaissanceCore = RootProject(uri("../../renaissance-core"))

lazy val reactorsCore = ProjectRef(uri("reactors"), "reactorsCoreJVM")
lazy val reactorsCommon = ProjectRef(uri("reactors"), "reactorsCommonJVM")

lazy val actorsReactors = (project in file("."))
.settings(
name := "actors-reactors",
version := (version in renaissanceCore).value,
organization := (organization in renaissanceCore).value,
scalaVersion := "2.12.13"
)
.dependsOn(
renaissanceCore,
reactorsCommon,
reactorsCore
)
1 change: 1 addition & 0 deletions benchmarks/actors-reactors/project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.2")
17 changes: 17 additions & 0 deletions benchmarks/actors-reactors/reactors/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.flooignore
.floo
tmp
# deployed docs
.tags_sorted_by_file
# idea crap
target
*.dmp
deploy
apidocs/
reactors-common/jvm/src/bench/scala/io/reactors/common/concurrent/cache-trie-remove-benches.scala
.sublime-project
# ctags stuff
*.iml
.idea/
# misc
.tags
27 changes: 27 additions & 0 deletions benchmarks/actors-reactors/reactors/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Copyright (c) 2013-2016, Reactors.IO
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.

* Neither the name of the {organization} nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Loading

0 comments on commit 8e3f720

Please sign in to comment.