Created
October 16, 2013 21:48
-
-
Save nremond/7015500 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
class NicoBench extends AbstractBenchmark { | |
val cacheUri = new ConcurrentHashMap[URI, Int] | |
@Test | |
@BenchmarkOptions(benchmarkRounds = 20000, warmupRounds = 5000, concurrency = 8) | |
def uri_hashcode() { | |
val uri = new URI("http://fake.com/" + ThreadLocalRandom.current.nextInt(0, 1000)) | |
cacheUri.putIfAbsent(uri, 123) | |
cacheUri.get(uri) | |
} | |
val cacheUriString = new ConcurrentHashMap[String, Int] | |
@Test | |
@BenchmarkOptions(benchmarkRounds = 20000, warmupRounds = 5000, concurrency = 8) | |
def uri_toString_hashcode() { | |
val uri = new URI("http://fake.com/" + ThreadLocalRandom.current.nextInt(0, 1000)).toString | |
cacheUriString.putIfAbsent(uri, 123) | |
cacheUriString.get(uri) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment