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
public class WindowedInvoker<T, R> { | |
private final Semaphore semaphore = new Semaphore(windowSize); | |
private class ReleasingCallback<R> implements Consumer<R> { | |
private final Consumer<R> delegate; | |
@Override | |
public void accept(R result) { | |
semaphore.release(); | |
delegate.accept(t); |
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
public class BatchingAggregator<T> { | |
private final int maxBatchSize; | |
private final InterruptableConsumer<T> consumer; | |
private final BlockingQueue<T> queue = new LinkedBlockingDeque<>(maxQueueSize); | |
private final Thread thread = new Thread(this::process); | |
{ | |
this.thread.start(); | |
} |
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
interface DataProvider<I, R> { | |
T calculate(I input); | |
} | |
@RequiredArgsConstructor | |
public class DataProviderCached<I, R> implements DataProvider<I, R> { | |
private final DataProvider delegate; | |
private final Map<I, R> cache = new ConcurrentHashMap<>(); | |
@Override |
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
@Data | |
class Result { | |
// ... | |
} | |
@Data | |
class Input { | |
// ... | |
} |
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
Apache Maven 3.5.2 (138edd61fd100ec658bfa2d307c43b76940a5d7d; 2017-10-18T09:58:13+02:00) | |
Maven home: /opt/apache-maven-3.5.2 | |
Java version: 9.0.4, vendor: Oracle Corporation | |
Java home: /opt/jdk-9.0.4 | |
Default locale: en_US, platform encoding: UTF-8 | |
OS name: "linux", version: "4.13.0-26-generic", arch: "amd64", family: "unix" | |
[INFO] Scanning for projects... | |
[INFO] | |
[INFO] ------------------------------------------------------------------------ | |
[INFO] Building junit-listener-test 1.0.0-SNAPSHOT |
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
$ cat /proc/cpuinfo | grep "model name" | uniq -c | |
8 model name : Intel(R) Core(TM) i7-4710MQ CPU @ 2.50GHz | |
$ LD_PRELOAD=/home/mmimica/Downloads/zlib-1.2.8/libz-ipp.so.1.2.8 java -jar target/benchmarks.jar | |
... | |
Benchmark (level) Mode Cnt Score Error Units | |
ZipBenchmark.systemZlib 1 thrpt 5 48.007 ± 1.441 ops/s | |
ZipBenchmark.systemZlib 3 thrpt 5 48.393 ± 1.966 ops/s | |
ZipBenchmark.systemZlib 6 thrpt 5 19.767 ± 0.830 ops/s | |
ZipBenchmark.systemZlib 9 thrpt 5 14.099 ± 0.412 ops/s |
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
package com.mmimica; | |
import java.io.*; | |
import java.util.concurrent.TimeUnit; | |
import java.util.zip.ZipEntry; | |
import java.util.zip.ZipOutputStream; | |
import org.openjdk.jmh.annotations.*; | |
import org.openjdk.jmh.infra.Blackhole; |
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
package com.mmimica; | |
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.concurrent.TimeUnit; | |
import java.util.stream.Stream; | |
import org.openjdk.jmh.annotations.*; | |
@State(Scope.Benchmark) | |
@BenchmarkMode(Mode.Throughput) | |
@Warmup(iterations = 10, time = 1, timeUnit = TimeUnit.SECONDS) |