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

JMH benchmarks (fibers) #6

Open
wants to merge 13 commits into
base: fibers
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.openjdk.jmh.annotations.Measurement;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.annotations.OutputTimeUnit;
import org.openjdk.jmh.annotations.Param;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
Expand All @@ -37,6 +38,9 @@
public class FfmpegProcessorPerformance {

private FileProcessor processor;

@Param({"10", "50", "100", "500", "1000", "5000"})
private int threads;

@Setup
public void setUp() throws Exception {
Expand All @@ -52,62 +56,74 @@ public void tearDown() {

@Benchmark
public void processWithAVI() throws Exception {
processor.setSourceFormat(Format.get("avi"));
processor.setSourceFile(TestUtil.getImage("avi"));
processor.process(
OperationList.builder().withOperations(new Encode(Format.get("png"))).build(),
Info.builder().withSize(640, 360).build(),
OutputStream.nullOutputStream());
for (int i=0; i<threads; i++){
processor.setSourceFormat(Format.get("avi"));
processor.setSourceFile(TestUtil.getImage("avi"));
processor.process(
OperationList.builder().withOperations(new Encode(Format.get("png"))).build(),
Info.builder().withSize(640, 360).build(),
OutputStream.nullOutputStream());
}
}

@Benchmark
public void processWithFLV() throws Exception {
processor.setSourceFormat(Format.get("flv"));
processor.setSourceFile(TestUtil.getImage("flv"));
processor.process(
OperationList.builder().withOperations(new Encode(Format.get("png"))).build(),
Info.builder().withSize(640, 360).build(),
OutputStream.nullOutputStream());
for (int i=0; i<threads; i++){
processor.setSourceFormat(Format.get("flv"));
processor.setSourceFile(TestUtil.getImage("flv"));
processor.process(
OperationList.builder().withOperations(new Encode(Format.get("png"))).build(),
Info.builder().withSize(640, 360).build(),
OutputStream.nullOutputStream());
}
}

@Benchmark
public void processWithMOV() throws Exception {
processor.setSourceFormat(Format.get("mov"));
processor.setSourceFile(TestUtil.getImage("mov"));
processor.process(
OperationList.builder().withOperations(new Encode(Format.get("png"))).build(),
Info.builder().withSize(640, 360).build(),
OutputStream.nullOutputStream());
for (int i=0; i<threads; i++){
processor.setSourceFormat(Format.get("mov"));
processor.setSourceFile(TestUtil.getImage("mov"));
processor.process(
OperationList.builder().withOperations(new Encode(Format.get("png"))).build(),
Info.builder().withSize(640, 360).build(),
OutputStream.nullOutputStream());
}
}

@Benchmark
public void processWithMP4() throws Exception {
processor.setSourceFormat(Format.get("mp4"));
processor.setSourceFile(TestUtil.getImage("mp4"));
processor.process(
OperationList.builder().withOperations(new Encode(Format.get("png"))).build(),
Info.builder().withSize(640, 360).build(),
OutputStream.nullOutputStream());
for (int i=0; i<threads; i++){
processor.setSourceFormat(Format.get("mp4"));
processor.setSourceFile(TestUtil.getImage("mp4"));
processor.process(
OperationList.builder().withOperations(new Encode(Format.get("png"))).build(),
Info.builder().withSize(640, 360).build(),
OutputStream.nullOutputStream());
}
}

@Benchmark
public void processWithMPG() throws Exception {
processor.setSourceFormat(Format.get("mpg"));
processor.setSourceFile(TestUtil.getImage("mpg"));
processor.process(
OperationList.builder().withOperations(new Encode(Format.get("png"))).build(),
Info.builder().withSize(640, 360).build(),
OutputStream.nullOutputStream());
for (int i=0; i<threads; i++){
processor.setSourceFormat(Format.get("mpg"));
processor.setSourceFile(TestUtil.getImage("mpg"));
processor.process(
OperationList.builder().withOperations(new Encode(Format.get("png"))).build(),
Info.builder().withSize(640, 360).build(),
OutputStream.nullOutputStream());
}
}

@Benchmark
public void processWithWebM() throws Exception {
processor.setSourceFormat(Format.get("webm"));
processor.setSourceFile(TestUtil.getImage("webm"));
processor.process(
OperationList.builder().withOperations(new Encode(Format.get("png"))).build(),
Info.builder().withSize(640, 360).build(),
OutputStream.nullOutputStream());
for (int i=0; i<threads; i++){
processor.setSourceFormat(Format.get("webm"));
processor.setSourceFile(TestUtil.getImage("webm"));
processor.process(
OperationList.builder().withOperations(new Encode(Format.get("png"))).build(),
Info.builder().withSize(640, 360).build(),
OutputStream.nullOutputStream());
}
}

@Benchmark
Expand Down
Loading