-
-
Notifications
You must be signed in to change notification settings - Fork 772
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Performance test for Lowercase transliterator; introduce JMH
JMH is the OpenJDK microbenchmark harness. It is a standardized tool with many integrations and provides a lot of out-of-the-box functionality. No existing perf-tests are changed https://github.com/openjdk/jmh
- Loading branch information
1 parent
e4f8f52
commit 2af99d6
Showing
3 changed files
with
87 additions
and
1 deletion.
There are no files selected for viewing
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
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
27 changes: 27 additions & 0 deletions
27
icu4j/perf-tests/src/main/java/com/ibm/icu/dev/test/perf/LowercaseTransliteratorPerf.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.ibm.icu.dev.test.perf; | ||
|
||
import java.util.concurrent.TimeUnit; | ||
|
||
import com.ibm.icu.text.Transliterator; | ||
import org.openjdk.jmh.annotations.Benchmark; | ||
import org.openjdk.jmh.annotations.BenchmarkMode; | ||
import org.openjdk.jmh.annotations.Mode; | ||
import org.openjdk.jmh.annotations.OutputTimeUnit; | ||
|
||
@BenchmarkMode(Mode.Throughput) | ||
@OutputTimeUnit(TimeUnit.MILLISECONDS) | ||
public class LowercaseTransliteratorPerf { | ||
|
||
static final Transliterator LOWER = Transliterator.getInstance("Lower"); | ||
|
||
@Benchmark | ||
public String testShort() { | ||
return LOWER.transliterate("Cat"); | ||
} | ||
|
||
@Benchmark | ||
public String testSentence() { | ||
return LOWER.transliterate("The Quick Brown Fox Jumped Over The Lazy Dog"); | ||
} | ||
|
||
} |