Skip to content

Instantly share code, notes, and snippets.

@ktoso
Created March 3, 2015 23:03
Show Gist options
  • Save ktoso/28d060ddb6931081a295 to your computer and use it in GitHub Desktop.
Save ktoso/28d060ddb6931081a295 to your computer and use it in GitHub Desktop.
package whoop.whoop
import java.util.concurrent.TimeUnit
import org.openjdk.jmh.annotations._
import scala.util.control.NoStackTrace
@State(Scope.Benchmark)
@BenchmarkMode(Array(Mode.AverageTime))
@OutputTimeUnit(TimeUnit.MICROSECONDS)
class NoStackTraceBenchmark {
class Ex extends RuntimeException("")
class ExNo extends RuntimeException("") with NoStackTrace
@Benchmark def normal = new Ex
@Benchmark def nostack = new ExNo
/*
just sayin'...
Benchmark Mode Cnt Score Error Units
NoStackTraceBenchmark.normal avgt 40 1.539 ± 0.140 us/op
NoStackTraceBenchmark.nostack avgt 40 0.010 ± 0.001 us/op
*/
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment