Created
May 2, 2014 00:26
-
-
Save voronaam/10afdd79790aa089eefd to your computer and use it in GitHub Desktop.
This file contains 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
Sample benchmark: https://gist.github.com/voronaam/11273582 | |
Setup instruction: http://blog.vorona.ca/measuring-scala-performance-with-jmh.html | |
Regexp benchmark: | |
someString.split("[_,;,-]"); | |
vs | |
private static final Pattern PATTERN = Pattern.compile("[_,;,-]"); | |
PATTERN.split(someString); | |
Results: | |
Benchmark Mode Samples Mean Mean error Units | |
c.t.r.MyBenchmark.testRegexSplit thrpt 200 2609.201 49.123 ops/ms | |
c.t.r.MyBenchmark.testStringSplit thrpt 200 1786.003 28.201 ops/ms | |
JMH samples: http://hg.openjdk.java.net/code-tools/jmh/file/tip/jmh-samples/src/main/java/org/openjdk/jmh/samples/ | |
Great presentation by JMH author: http://shipilev.net/talks/jvmls-July2013-benchmarking.pdf | |
JMH author: http://shipilev.net/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment