Forked from ktoso/to-stack-or-not-to-stack.scala
Last active
August 29, 2015 14:16
-
-
Save ochoto/706c650cc3be3b883500 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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