From 01fb475f8abe519b5e22291c544f12aeda8a8fa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Wawrzyk?= Date: Thu, 2 Aug 2018 12:35:54 +0200 Subject: [PATCH] Add jmh --- build.sbt | 8 +++++++- project/plugins.sbt | 1 + .../scala/org/virtuslab/zipops/bench/Bench.scala | 13 +++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 project/plugins.sbt create mode 100644 src/main/scala/org/virtuslab/zipops/bench/Bench.scala diff --git a/build.sbt b/build.sbt index 0f0c81f..cc6beb5 100644 --- a/build.sbt +++ b/build.sbt @@ -7,4 +7,10 @@ scalaVersion := "2.12.5" resolvers += Resolver.sonatypeRepo("snapshots") resolvers += Resolver.sonatypeRepo("releases") -libraryDependencies += "net.lingala.zip4j" % "zip4j" % "1.3.2" +libraryDependencies ++= Seq( + "net.lingala.zip4j" % "zip4j" % "1.3.2", + "org.openjdk.jmh" % "jmh-core" % "1.21", + "org.openjdk.jmh" % "jmh-generator-annprocess" % "1.21" +) + +enablePlugins(JmhPlugin) \ No newline at end of file diff --git a/project/plugins.sbt b/project/plugins.sbt new file mode 100644 index 0000000..a816792 --- /dev/null +++ b/project/plugins.sbt @@ -0,0 +1 @@ +addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.3.4") \ No newline at end of file diff --git a/src/main/scala/org/virtuslab/zipops/bench/Bench.scala b/src/main/scala/org/virtuslab/zipops/bench/Bench.scala new file mode 100644 index 0000000..a4df8a6 --- /dev/null +++ b/src/main/scala/org/virtuslab/zipops/bench/Bench.scala @@ -0,0 +1,13 @@ +package org.virtuslab.zipops.bench + +import org.openjdk.jmh.annotations.Benchmark +import org.openjdk.jmh.infra.Blackhole + +object Bench { + + @Benchmark + def benchmark(hole: Blackhole): Unit = { + hole.consume(5 * 7) + } + +}