You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
lazy val Benchmark = config("bench") extend Test
/** This allows running ScalaMeter benchmarks in separate sbt configuration.
* It means, that when you want run your benchmarks you should type `bench:test` in sbt console.
*/
lazy val basic: Project = (project in file("."))
.settings(Seq(
name := "leap-year",
organization := "com.storm-enroute",
scalaVersion := "2.12.1",
scalacOptions ++= Seq("-deprecation", "-unchecked", "-feature", "-Xlint"),
publishArtifact := false,
libraryDependencies ++= Seq(
"com.storm-enroute" %% "scalameter" % version.value % "bench", // ScalaMeter version is set in version.sbt
"org.scalatest" %% "scalatest" % "3.0.1" % "test"
),
resolvers ++= Seq(
"Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots",
"Sonatype OSS Releases" at "https://oss.sonatype.org/content/repositories/releases"
),
testFrameworks += new TestFramework("org.scalameter.ScalaMeterFramework"),
parallelExecution in Benchmark := false,
logBuffered := false
)
) configs(
Benchmark
) settings(
inConfig(Benchmark)(Defaults.testSettings): _*
)
Here is the version.sbt file:
version in ThisBuild := "0.18"
Here is project/build.properties:
sbt.version=0.13.15
Lastly, here is the simple benchmark I am trying to work with:
package leap.benchmark
import org.scalameter.api._
object RangeBenchmark
extends Bench.LocalTime {
val years = Gen.range("year")(1, 9999, 1)
def leapYear(year: Int) = year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)
def nonOptimalLeapYear(year: Int) = year % 400 == 0 || (year % 4 == 0 && year % 100 != 0)
performance of "Leap" in {
measure method "leapYear" in {
using(years) in {
year => leapYear(year)
}
}
}
}
From the root directory...
$ sbt
[info] Loading project definition from <REDACTED>/eap/project
[info] Set current project to leap-year (in build file:<REDACTED>/leap/)
> bench:test
[info] Updating {file:<REDACTED>/leap/}basic...
[info] Resolving jline#jline;2.14.1 ...
[info] Done updating.
[info] Compiling 2 Scala sources to <REDACTED>/leap/target/scala-2.12/test-classes...
[error] <REDACTED>/leap/src/test/scala/benchmark/LeapBenchmark.scala:3: object scalameter is not a member of package org
[error] import org.scalameter.api._
Any help I can get with setting this up so that I can actually run benchmarks would be appreciated.
The text was updated successfully, but these errors were encountered:
Here is my build.sbt
Here is the version.sbt file:
Here is project/build.properties:
Lastly, here is the simple benchmark I am trying to work with:
From the root directory...
Any help I can get with setting this up so that I can actually run benchmarks would be appreciated.
The text was updated successfully, but these errors were encountered: