Skip to content

Commit

Permalink
Test actions benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
felldo committed Nov 17, 2023
1 parent 7ec8d8b commit b44a69f
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 7 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/jmh.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Benchmark
on:
push:
branches:
- main
- testyml
pull_request:
branches:
- main
- testyml

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
- name: JMH Benchmark Action
uses: kitlangton/jmh-benchmark-action@main
with:
jmh-output-path: lib/build/results/jmh/results.json
github-token: ${{ secrets.GITHUB_TOKEN }}
8 changes: 4 additions & 4 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].
//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
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 @@ -72,10 +91,10 @@ public List<Emoji> extractEmojisInOrderOnlyEmojisLengthDescending() {
public List<Emoji> extractEmojisInOrderOnlyEmojisRandomOrder() {
return EmojiManager.extractEmojisInOrder(EMOJIS_RANDOM_ORDER);
}

/*
@Benchmark
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

0 comments on commit b44a69f

Please sign in to comment.