Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testyml #23

Closed
wants to merge 18 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/workflows/jmh.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Benchmark
on:
push:
branches:
- master
- testyml
pull_request:
branches:
- master
- testyml
- testmerge

permissions:
contents: write
pull-requests: write

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
- name: Build and run JMH benchmark
run: |
./gradlew jmh
ls -a
cd lib
ls -a
cd build
ls -a
cd results
ls -a
cd jmh
ls -a
- name: JMH Benchmark Action
uses: kitlangton/jmh-benchmark-action@main
with:
jmh-output-path: ./lib/results.json
github-token: ${{ secrets.GITHUB_TOKEN }}
6 changes: 3 additions & 3 deletions lib/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,15 @@ jmh {
// operationsPerInvocation.set(10) // Operations per invocation.
// //benchmarkParameters.put("", ListProperty) // Benchmark parameters.
// profilers.addAll("") // Use profilers to collect additional data. Supported profilers: [cl, comp, gc, stack, perf, perfnorm, perfasm, xperf, xperfasm, hs_cl, hs_comp, hs_gc, hs_rt, hs_thr, async]
// timeOnIteration.set("1s") // Time to spend at each measurement iteration.
// resultFormat.set("CSV") // Result format type (one of CSV, JSON, NONE, SCSV, TEXT)
timeOnIteration.set("1s") // Time to spend at each measurement iteration.
resultFormat.set("JSON") // Result format type (one of CSV, JSON, NONE, SCSV, TEXT)
// synchronizeIterations.set(false) // Synchronize iterations?
// threads.set(4) // Number of worker threads to run with.
// threadGroups.addAll(2,3,4) //Override thread group distribution for asymmetric benchmarks.
// jmhTimeout.set("1s") // Timeout for benchmark iteration.
timeUnit.set("ms") // Output time unit. Available time units are: [m, s, ms, us, ns].
// verbosity.set("NORMAL") // Verbosity mode. Available modes are: [SILENT, NORMAL, EXTRA]
// warmup.set("1s") // Time to spend at each warmup iteration.
warmup.set("1s") // Time to spend at each warmup iteration.
// warmupBatchSize.set(10) // Warmup batch size: number of benchmark method calls per operation.
// warmupForks.set(0) // How many warmup forks to make for a single benchmark. 0 to disable warmup forks.
// warmupIterations.set(1) // Number of warmup iterations to do.
Expand Down
67 changes: 67 additions & 0 deletions lib/results.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
[
{
"jmhVersion" : "1.36",
"benchmark" : "benchmark.EmojiManagerBenchmark.replaceAllEmojis",
"mode" : "avgt",
"threads" : 1,
"forks" : 2,
"jvm" : "C:\\Users\\domme\\.jdks\\temurin-1.8.0_372\\jre\\bin\\java.exe",
"jvmArgs" : [
"-Dfile.encoding=UTF-8",
"-Djava.io.tmpdir=C:\\Users\\domme\\IdeaProjects\\JEmoji\\lib\\build\\tmp\\jmh",
"-Duser.country=DE",
"-Duser.language=de",
"-Duser.variant"
],
"jdkVersion" : "1.8.0_372",
"vmName" : "OpenJDK 64-Bit Server VM",
"vmVersion" : "25.372-b07",
"warmupIterations" : 5,
"warmupTime" : "1 s",
"warmupBatchSize" : 1,
"measurementIterations" : 5,
"measurementTime" : "1 s",
"measurementBatchSize" : 1,
"primaryMetric" : {
"score" : 3.148199216544026,
"scoreError" : 0.014014649494046228,
"scoreConfidence" : [
3.1341845670499797,
3.162213866038072
],
"scorePercentiles" : {
"0.0" : 3.1340021604938273,
"50.0" : 3.146212888198758,
"90.0" : 3.1620971845794394,
"95.0" : 3.1623625,
"99.0" : 3.1623625,
"99.9" : 3.1623625,
"99.99" : 3.1623625,
"99.999" : 3.1623625,
"99.9999" : 3.1623625,
"100.0" : 3.1623625
},
"scoreUnit" : "ms",
"rawData" : [
[
3.142491950464396,
3.152234375,
3.1432819875776397,
3.1597093457943926,
3.1340021604938273
],
[
3.156177258566978,
3.1393068111455107,
3.1623625,
3.148958695652174,
3.1434670807453418
]
]
},
"secondaryMetrics" : {
}
}
]


23 changes: 21 additions & 2 deletions lib/src/jmh/java/benchmark/EmojiManagerBenchmark.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,25 @@

public class EmojiManagerBenchmark {


/*
<tem
Benchmark Mode Cnt Score Error Units
EmojiManagerBenchmark.extractEmojisInOrder avgt 10 2,206 ± 0,013 ms/op
EmojiManagerBenchmark.extractEmojisInOrderOnlyEmojisLengthDescending avgt 10 9,773 ± 0,083 ms/op
EmojiManagerBenchmark.extractEmojisInOrderOnlyEmojisRandomOrder avgt 10 10,469 ± 0,107 ms/op
EmojiManagerBenchmark.removeAllEmojis avgt 10 2,822 ± 0,026 ms/op
EmojiManagerBenchmark.replaceAllEmojis avgt 10 2,836 ± 0,070 ms/op
EmojiManagerBenchmark.replaceAllEmojisFunction avgt 10 2,834 ± 0,015 ms/op

Benchmark Mode Cnt Score Error Units
EmojiManagerBenchmark.extractEmojisInOrder avgt 10 2,186 ± 0,057 ms/op
EmojiManagerBenchmark.extractEmojisInOrderOnlyEmojisLengthDescending avgt 10 10,044 ± 0,117 ms/op
EmojiManagerBenchmark.extractEmojisInOrderOnlyEmojisRandomOrder avgt 10 10,584 ± 0,196 ms/op
EmojiManagerBenchmark.removeAllEmojis avgt 10 3,062 ± 0,203 ms/op
EmojiManagerBenchmark.replaceAllEmojis avgt 10 3,034 ± 0,042 ms/op
EmojiManagerBenchmark.replaceAllEmojisFunction avgt 10 3,319 ± 0,281 ms/op
*/
private static final String TEXT = new BufferedReader(new InputStreamReader(Objects.requireNonNull(EmojiManagerBenchmark.class.getClassLoader().getResourceAsStream("ExampleTextFileWithEmojis.txt"))))
.lines().collect(Collectors.joining("\n"));

Expand Down Expand Up @@ -47,7 +66,7 @@ public static void main(String[] args) throws Exception {
public String replaceAllEmojis() {
return EmojiManager.replaceAllEmojis(TEXT, "<replaced emoji>");
}

/*
@Benchmark
public String replaceAllEmojisFunction() {
return EmojiManager.replaceAllEmojis(TEXT, emoji -> emoji.getGroup().toString());
Expand Down Expand Up @@ -77,5 +96,5 @@ public List<Emoji> extractEmojisInOrderOnlyEmojisRandomOrder() {
public boolean containsEmoji() {
return EmojiManager.containsEmoji(CONTAINS_EMOJI_TEXT);
}

*/
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package benchmark;
package benchmark.excluded;

import net.fellbaum.jemoji.Emoji;
import net.fellbaum.jemoji.EmojiManager;
Expand Down
Loading
Loading