Last active
August 29, 2015 14:00
-
-
Save voronaam/11273582 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
/** Test results: | |
Benchmark Mode Samples Mean Mean error Units | |
c.t.MyBenchmark.testString thrpt 200 391517.835 3311.834 ops/ms | |
c.t.MyBenchmark.testSymbol thrpt 200 36618.384 193.733 ops/ms | |
*/ | |
package com.test { | |
import org.openjdk.jmh.annotations.GenerateMicroBenchmark | |
class MyBenchmark { | |
def testStringData = "test" | |
def testSymbolData = 'test | |
@GenerateMicroBenchmark | |
def testString(): Any = { | |
testStringData match { | |
case "some" => 1L | |
case "other" => 2L | |
case "test" => 3L | |
case _ => 4L | |
} | |
} | |
@GenerateMicroBenchmark | |
def testSymbol(): Any = { | |
testSymbolData match { | |
case 'some => 1L | |
case 'other => 2L | |
case 'test => 3L | |
case _ => 4L | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment