GithubHelp home page GithubHelp logo

Upgrade to JMH 1.4 about sbt-jmh HOT 10 CLOSED

sbt avatar sbt commented on June 3, 2024
Upgrade to JMH 1.4

from sbt-jmh.

Comments (10)

ktoso avatar ktoso commented on June 3, 2024

Thanks for the ping, bumped the dependency: 5ecebe5 (0.1.8)
Should be online already.

from sbt-jmh.

sirthias avatar sirthias commented on June 3, 2024

Wow, that was fast!
Many thanks!

from sbt-jmh.

ktoso avatar ktoso commented on June 3, 2024

no time to lose! :-)

from sbt-jmh.

sirthias avatar sirthias commented on June 3, 2024

For some reason the JMH dependency in 0.1.8 is still onto 1.3.1:

[info] downloading https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/pl.project13.scala/sbt-jmh/scala_2.10/sbt_0.13/0.1.8/jars/sbt-jmh.jar ...
[info]  [SUCCESSFUL ] pl.project13.scala#sbt-jmh;0.1.8!sbt-jmh.jar (2245ms)
[info] Done updating.
[info] Set current project to root (in build file:/.../)
root > p benchmark
[info] Set current project to benchmark (in build file:/.../)
benchmark > show libraryDependencies
[info] List(org.scala-lang:scala-library:2.11.5, org.openjdk.jmh:jmh-core:1.3.1, org.openjdk.jmh:jmh-generator-bytecode:1.3.1, org.openjdk.jmh:jmh-generator-reflection:1.3.1)
benchmark >

Maybe the JAR somehow didn't get rebuilt properly for the latest release?

from sbt-jmh.

ktoso avatar ktoso commented on June 3, 2024

Hm... thanks for the info, I'll look into that today evening

from sbt-jmh.

sirthias avatar sirthias commented on June 3, 2024

Thanks, Konrad!
Meanwhile JMH 1.5 has been released.
Maybe it's even possible to upgrade to that right away.

from sbt-jmh.

ktoso avatar ktoso commented on June 3, 2024

Had a silly mistake in the 1.8 release: c20646b#diff-656d44ed3ab355d919402897bec8a9bdL44

Now fixed and released 0.1.9 with 1.5 support. Happy hakking!

from sbt-jmh.

sirthias avatar sirthias commented on June 3, 2024

Great! Thanks!

One more (unrelated) question that I am just about to look into:
Do you know the best way to access the benchmark results programmatically?
It seems I need to get a public static main method into the benchmark class, which is not as easy as it should be. I'm thinking a parent class written in Java which simply calls out to a Scala object could do the trick, but I might be missing something.

from sbt-jmh.

ktoso avatar ktoso commented on June 3, 2024

Good and bad news for that one.

Good comes first. You can either just write a main class that invokes the runner explicitly, and then gets the results from a run(). You also can give a custom output formatter, as shown below.

package org.openjdk.jmh

import java.util

import org.openjdk.jmh._
import org.openjdk.jmh.infra.{IterationParams, BenchmarkParams}
import org.openjdk.jmh.results.{BenchmarkResult, RunResult, IterationResult}
import org.openjdk.jmh.runner.Runner
import org.openjdk.jmh.runner.format.OutputFormat
import org.openjdk.jmh.runner.options.CommandLineOptions

object RunnerApp extends App {
  import collection.JavaConversions._

  val opts = new CommandLineOptions(args: _*)

  val formatter = new OutputFormat {override def iteration(benchmarkParams: BenchmarkParams, iterationParams: IterationParams, i: Int): Unit = ???

    override def endBenchmark(benchmarkResult: BenchmarkResult): Unit = ???

    override def endRun(collection: java.util.Collection[RunResult]): Unit = ???

    override def flush(): Unit = ???

    override def write(i: Int): Unit = ???

    override def write(bytes: Array[Byte]): Unit = ???

    override def startBenchmark(benchmarkParams: BenchmarkParams): Unit = ???

    override def startRun(): Unit = ???

    override def close(): Unit = ???

    override def println(s: String): Unit = ???

    override def verbosePrintln(s: String): Unit = ???

    override def iterationResult(benchmarkParams: BenchmarkParams, iterationParams: IterationParams, i: Int, iterationResult: IterationResult): Unit = ???

    override def print(s: String): Unit = ???
  }

//  val runner = new Runner(opts, formatter)
  val runner = new Runner(opts)

  val res = runner.run()

  res.foreach { r 
    println("r.getAggregatedResult = " + r.getAggregatedResult)
  }

}

Now bad news: It won't work "just like that"... Currently we'd get class not founds because of the generated classes not being on the classpath of when you runMain something. I think this should be solvable by adding ./target/scala-2.10/classes/ to the classpath for runMain hm. I'll create a ticket and look into it.

Other hints: depends what you're doing (getting programatic access becomes a ticket now ;-)),
maybe exporting to csv or json would be useful? That's just an option and would work now, the available output formats are: [info] Available formats: text, csv, scsv, json, latex.

from sbt-jmh.

sirthias avatar sirthias commented on June 3, 2024

Great. Thanks for the info. I'll work something out and let you know...

from sbt-jmh.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.