From c6dd2a5e2a5db5e61015f33c5666e3a2332b3c63 Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Thu, 2 Jun 2016 21:58:25 +0200 Subject: [PATCH] Remove unused module microbenchmark-template --- microbenchmark-template/README.md | 1 - microbenchmark-template/pom.xml | 90 -------- microbenchmark-template/run.sh | 8 - .../microbenchmark/FileSourceDbBenchmark.java | 150 ------------- .../sonar/microbenchmark/HashBenchmark.java | 137 ------------ .../SerializationBenchmark.java | 203 ------------------ .../SerializationBenchmarkTest.java | 96 --------- pom.xml | 8 - 8 files changed, 693 deletions(-) delete mode 100644 microbenchmark-template/README.md delete mode 100644 microbenchmark-template/pom.xml delete mode 100755 microbenchmark-template/run.sh delete mode 100644 microbenchmark-template/src/main/java/org/sonar/microbenchmark/FileSourceDbBenchmark.java delete mode 100644 microbenchmark-template/src/main/java/org/sonar/microbenchmark/HashBenchmark.java delete mode 100644 microbenchmark-template/src/main/java/org/sonar/microbenchmark/SerializationBenchmark.java delete mode 100644 microbenchmark-template/src/test/java/org/sonar/microbenchmark/SerializationBenchmarkTest.java diff --git a/microbenchmark-template/README.md b/microbenchmark-template/README.md deleted file mode 100644 index 8beaf58c640..00000000000 --- a/microbenchmark-template/README.md +++ /dev/null @@ -1 +0,0 @@ -Template for quickly write micro-benchmarks with JMH diff --git a/microbenchmark-template/pom.xml b/microbenchmark-template/pom.xml deleted file mode 100644 index 167cad4694f..00000000000 --- a/microbenchmark-template/pom.xml +++ /dev/null @@ -1,90 +0,0 @@ - - - 4.0.0 - - org.sonarsource.sonarqube - sonarqube - 6.0-SNAPSHOT - - microbenchmark-template - jar - - - - ${project.groupId} - sonar-batch-protocol - ${project.version} - - - com.esotericsoftware - kryo-shaded - 3.0.0 - - - ${project.groupId} - sonar-plugin-api - ${project.version} - - - ${project.groupId} - sonar-db - ${project.version} - - - com.google.code.gson - gson - - - org.openjdk.jmh - jmh-core - ${jmh.version} - - - org.openjdk.jmh - jmh-generator-annprocess - ${jmh.version} - provided - - - - ${project.groupId} - sonar-testing-harness - ${project.version} - test - - - - - UTF-8 - 1.5.1 - microbenchmark - - - - - - org.apache.maven.plugins - maven-shade-plugin - 2.2 - - - package - - shade - - - ${uberjar.name} - - - org.openjdk.jmh.Main - - - - - - - - - - diff --git a/microbenchmark-template/run.sh b/microbenchmark-template/run.sh deleted file mode 100755 index ab222188dee..00000000000 --- a/microbenchmark-template/run.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -# The command-line arguments can be used to list the benchmarks to be executed. -# By default all benchmarks are executed. -# Example: run.sh org.sonar.microbenchmark.SerializationBenchmark - -mvn clean install -java -jar target/microbenchmark.jar $* diff --git a/microbenchmark-template/src/main/java/org/sonar/microbenchmark/FileSourceDbBenchmark.java b/microbenchmark-template/src/main/java/org/sonar/microbenchmark/FileSourceDbBenchmark.java deleted file mode 100644 index 94110d436cc..00000000000 --- a/microbenchmark-template/src/main/java/org/sonar/microbenchmark/FileSourceDbBenchmark.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonar.microbenchmark; - -import com.google.protobuf.CodedOutputStream; -import java.io.ByteArrayOutputStream; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.concurrent.TimeUnit; -import org.apache.commons.lang.RandomStringUtils; -import org.openjdk.jmh.annotations.Benchmark; -import org.openjdk.jmh.annotations.BenchmarkMode; -import org.openjdk.jmh.annotations.Fork; -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; -import org.openjdk.jmh.annotations.Warmup; -import org.openjdk.jmh.runner.Runner; -import org.openjdk.jmh.runner.RunnerException; -import org.openjdk.jmh.runner.options.Options; -import org.openjdk.jmh.runner.options.OptionsBuilder; -import org.sonar.server.source.db.FileSourceDb; - -/** - * - * See https://code.google.com/p/xxhash/ and https://github.com/jpountz/lz4-java - * - */ -@OutputTimeUnit(TimeUnit.MILLISECONDS) -@State(Scope.Thread) -@Fork(1) -@Warmup(iterations = 5) -@Measurement(iterations = 5) -@BenchmarkMode(Mode.Throughput) -public class FileSourceDbBenchmark { - - @Param({"10", "100", "1000", "100000"}) - public int linesNumber; - - List lines = new ArrayList<>(); - FileSourceDb.Data data; - - @Setup - public void setup() throws Exception { - FileSourceDb.Data.Builder builder = FileSourceDb.Data.newBuilder(); - for (int i = 0; i < linesNumber; i++) { - FileSourceDb.Line.Builder lineBuilder = builder.addLinesBuilder(); - lines.add(lineBuilder - .setLine(i + 1) - .setScmAuthor("charlie") - .setScmRevision("ABCDE") - .setScmDate(15000000000L) - .setUtLineHits(5) - .setUtConditions(2) - .setUtCoveredConditions(1) - .setSource(RandomStringUtils.randomAlphanumeric(10)) - .setHighlighting(RandomStringUtils.randomAlphanumeric(20)) - .setSymbols(RandomStringUtils.randomAlphanumeric(20)) - .addAllDuplication(Arrays.asList(12, 13, 15)) - .build()); - } - data = builder.build(); - } - - @Benchmark - public int container() throws Exception { - ByteArrayOutputStream byteOutput = new ByteArrayOutputStream(); - data.writeTo(byteOutput); - byteOutput.close(); - return byteOutput.toByteArray().length; - } - - @Benchmark - public int delimiters() throws Exception { - ByteArrayOutputStream byteOutput = new ByteArrayOutputStream(); - for (FileSourceDb.Line line : lines) { - line.writeDelimitedTo(byteOutput); - } - byteOutput.close(); - return byteOutput.toByteArray().length; - } - - @Benchmark - public int codedstream_container() throws Exception { - ByteArrayOutputStream byteOutput = new ByteArrayOutputStream(); - CodedOutputStream writer = CodedOutputStream.newInstance(byteOutput); - writer.writeRawVarint32(data.getSerializedSize()); - writer.writeRawBytes(data.toByteArray()); - writer.flush(); - byteOutput.close(); - return byteOutput.toByteArray().length; - } - - @Benchmark - public int codedstream_container_known_size() throws Exception { - ByteArrayOutputStream byteOutput = new ByteArrayOutputStream(data.getSerializedSize()); - CodedOutputStream writer = CodedOutputStream.newInstance(byteOutput); - writer.writeRawVarint32(data.getSerializedSize()); - writer.writeRawBytes(data.toByteArray()); - writer.flush(); - byteOutput.close(); - return byteOutput.toByteArray().length; - } - - @Benchmark - public int codedstream_delimiters() throws Exception { - ByteArrayOutputStream byteOutput = new ByteArrayOutputStream(); - CodedOutputStream writer = CodedOutputStream.newInstance(byteOutput); - for (FileSourceDb.Line line : lines) { - writer.writeRawVarint32(line.getSerializedSize()); - writer.writeRawBytes(line.toByteArray()); - } - writer.flush(); - byteOutput.close(); - return byteOutput.toByteArray().length; - } - - /** - * You can this benchmark with maven command-line (see run.sh) or by executing this method - * in IDE - */ - public static void main(String[] args) throws RunnerException { - Options opt = new OptionsBuilder() - .include(FileSourceDbBenchmark.class.getSimpleName()) - .build(); - new Runner(opt).run(); - } -} diff --git a/microbenchmark-template/src/main/java/org/sonar/microbenchmark/HashBenchmark.java b/microbenchmark-template/src/main/java/org/sonar/microbenchmark/HashBenchmark.java deleted file mode 100644 index 11bc14293b9..00000000000 --- a/microbenchmark-template/src/main/java/org/sonar/microbenchmark/HashBenchmark.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonar.microbenchmark; - -import net.jpountz.xxhash.XXHash32; -import net.jpountz.xxhash.XXHash64; -import net.jpountz.xxhash.XXHashFactory; -import org.apache.commons.codec.digest.DigestUtils; -import org.apache.commons.lang.StringUtils; -import org.openjdk.jmh.annotations.Benchmark; -import org.openjdk.jmh.annotations.BenchmarkMode; -import org.openjdk.jmh.annotations.Fork; -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; -import org.openjdk.jmh.annotations.Warmup; -import org.openjdk.jmh.runner.Runner; -import org.openjdk.jmh.runner.RunnerException; -import org.openjdk.jmh.runner.options.Options; -import org.openjdk.jmh.runner.options.OptionsBuilder; - -import java.util.concurrent.TimeUnit; - -/** - * - * See https://code.google.com/p/xxhash/ and https://github.com/jpountz/lz4-java - * - */ -@OutputTimeUnit(TimeUnit.MILLISECONDS) -@State(Scope.Thread) -@Fork(1) -@Warmup(iterations = 3) -@Measurement(iterations = 3) -@BenchmarkMode(Mode.Throughput) -public class HashBenchmark { - - @Param({"1", "100", "1000", "10000", "100000", "1000000"}) - public int size; - - XXHash32 xxHash32Jni = XXHashFactory.fastestInstance().hash32(); - XXHash64 xxHash64Jni = XXHashFactory.fastestInstance().hash64(); - XXHash32 xxHash32Unsafe = XXHashFactory.fastestJavaInstance().hash32(); - XXHash64 xxHash64Unsafe = XXHashFactory.fastestJavaInstance().hash64(); - XXHash32 xxHash32 = XXHashFactory.safeInstance().hash32(); - XXHash64 xxHash64 = XXHashFactory.safeInstance().hash64(); - - byte[] bytes; - - @Setup - public void setup() throws Exception { - bytes = StringUtils.repeat("3", size).getBytes(); - } - - @Benchmark - public String commonsCodecMd5() throws Exception { - return DigestUtils.md5Hex(bytes); - } - - @Benchmark - public String commonsCodecSha1() throws Exception { - return DigestUtils.sha1Hex(bytes); - } - - @Benchmark - public int xxhash32() throws Exception { - int seed = 0x9747b28c; // used to initialize the hash value, use whatever - // value you want, but always the same - return xxHash32.hash(bytes, 0, bytes.length, seed); - } - - @Benchmark - public int xxhash32Jni() throws Exception { - int seed = 0x9747b28c; // used to initialize the hash value, use whatever - // value you want, but always the same - return xxHash32Jni.hash(bytes, 0, bytes.length, seed); - } - - @Benchmark - public int xxhash32Unsafe() throws Exception { - int seed = 0x9747b28c; // used to initialize the hash value, use whatever - // value you want, but always the same - return xxHash32Unsafe.hash(bytes, 0, bytes.length, seed); - } - - @Benchmark - public long xxhash64() throws Exception { - int seed = 0x9747b28c; // used to initialize the hash value, use whatever - // value you want, but always the same - return xxHash64.hash(bytes, 0, bytes.length, seed); - } - - @Benchmark - public long xxhash64Jni() throws Exception { - int seed = 0x9747b28c; // used to initialize the hash value, use whatever - // value you want, but always the same - return xxHash64Jni.hash(bytes, 0, bytes.length, seed); - } - - @Benchmark - public long xxhash64Unsafe() throws Exception { - int seed = 0x9747b28c; // used to initialize the hash value, use whatever - // value you want, but always the same - return xxHash64Unsafe.hash(bytes, 0, bytes.length, seed); - } - - /** - * You can this benchmark with maven command-line (see run.sh) or by executing this method - * in IDE - */ - public static void main(String[] args) throws RunnerException { - Options opt = new OptionsBuilder() - .include(HashBenchmark.class.getSimpleName()) - .build(); - new Runner(opt).run(); - } -} diff --git a/microbenchmark-template/src/main/java/org/sonar/microbenchmark/SerializationBenchmark.java b/microbenchmark-template/src/main/java/org/sonar/microbenchmark/SerializationBenchmark.java deleted file mode 100644 index ff9361d7a0c..00000000000 --- a/microbenchmark-template/src/main/java/org/sonar/microbenchmark/SerializationBenchmark.java +++ /dev/null @@ -1,203 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonar.microbenchmark; - -import com.esotericsoftware.kryo.Kryo; -import com.esotericsoftware.kryo.io.Output; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.stream.JsonWriter; -import java.io.BufferedOutputStream; -import java.io.BufferedWriter; -import java.io.Externalizable; -import java.io.File; -import java.io.FileOutputStream; -import java.io.FileWriter; -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.io.ObjectOutputStream; -import java.io.OutputStream; -import java.io.Serializable; -import java.util.Arrays; -import java.util.List; -import java.util.concurrent.TimeUnit; -import org.openjdk.jmh.annotations.Benchmark; -import org.openjdk.jmh.annotations.BenchmarkMode; -import org.openjdk.jmh.annotations.Fork; -import org.openjdk.jmh.annotations.Measurement; -import org.openjdk.jmh.annotations.Mode; -import org.openjdk.jmh.annotations.OutputTimeUnit; -import org.openjdk.jmh.annotations.Scope; -import org.openjdk.jmh.annotations.Setup; -import org.openjdk.jmh.annotations.State; -import org.openjdk.jmh.annotations.Warmup; -import org.openjdk.jmh.runner.Runner; -import org.openjdk.jmh.runner.RunnerException; -import org.openjdk.jmh.runner.options.Options; -import org.openjdk.jmh.runner.options.OptionsBuilder; -import org.sonar.batch.protocol.Constants; -import org.sonar.batch.protocol.output.BatchReport; - -@OutputTimeUnit(TimeUnit.MILLISECONDS) -@State(Scope.Thread) -@Fork(1) -@Warmup(iterations = 5) -@Measurement(iterations = 5) -@BenchmarkMode(Mode.Throughput) -public class SerializationBenchmark { - - File outputFile; - private final Gson gson = new GsonBuilder().create(); - - @Setup - public void setup() throws Exception { - outputFile = File.createTempFile("microbenchmark", ".out"); - } - - @Benchmark - public void write_gson() throws Exception { - JsonWriter writer = new JsonWriter(new BufferedWriter(new FileWriter(outputFile, false))); - writer.beginArray(); - for (int i = 0; i < 10000; i++) { - Issue issue = new Issue(); - issue.uuid = "UUID_" + i; - issue.severity = "BLOCKER"; - issue.message = "this is the message of issue " + i; - issue.line = i; - issue.author = "someone"; - issue.tags = Arrays.asList("tag" + i, "othertag" + i); - gson.toJson(issue, Issue.class, writer); - } - writer.endArray(); - writer.close(); - } - - @Benchmark - public void write_protobuf() throws Exception { - // Write stream of objects with delimiter - // An alternative can be http://stackoverflow.com/a/21870564/229031 - try (OutputStream out = new BufferedOutputStream(new FileOutputStream(outputFile, false))) { - for (int i = 0; i < 10000; i++) { - BatchReport.Issue.Builder issueBuilder = BatchReport.Issue.newBuilder(); - issueBuilder.setUuid("UUID_" + i); - issueBuilder.setSeverity(Constants.Severity.BLOCKER); - issueBuilder.setMsg("this is the message of issue " + i); - issueBuilder.setLine(i); - issueBuilder.setAuthorLogin("someone"); - issueBuilder.addAllTag(Arrays.asList("tag" + i, "othertag" + i)); - issueBuilder.build().writeDelimitedTo(out); - } - } - } - - @Benchmark - public void write_serializable() throws Exception { - try (ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(new FileOutputStream(outputFile, false)))) { - for (int i = 0; i < 10000; i++) { - Issue issue = new Issue(); - issue.uuid = "UUID_" + i; - issue.severity = "BLOCKER"; - issue.message = "this is the message of issue " + i; - issue.line = i; - issue.author = "someone"; - issue.tags = Arrays.asList("tag" + i, "othertag" + i); - out.writeObject(issue); - } - } - } - - @Benchmark - public void write_externalizable() throws Exception { - try (ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(new FileOutputStream(outputFile, false)))) { - for (int i = 0; i < 10000; i++) { - ExternalizableIssue issue = new ExternalizableIssue(); - issue.uuid = "UUID_" + i; - issue.severity = "BLOCKER"; - issue.message = "this is the message of issue " + i; - issue.line = i; - issue.author = "someone"; - issue.tags = Arrays.asList("tag" + i, "othertag" + i); - out.writeObject(issue); - } - } - } - - @Benchmark - public void write_kryo() throws Exception { - Kryo kryo = new Kryo(); - OutputStream stream = new BufferedOutputStream(new FileOutputStream(outputFile, false)); - Output output = new Output(stream); - for (int i = 0; i < 10000; i++) { - Issue issue = new Issue(); - issue.uuid = "UUID_" + i; - issue.severity = "BLOCKER"; - issue.message = "this is the message of issue " + i; - issue.line = i; - issue.author = "someone"; - issue.tags = Arrays.asList("tag" + i, "othertag" + i); - kryo.writeObject(output, issue); - } - output.close(); - } - - public static class Issue implements Serializable { - String uuid, severity, message, author; - int line; - List tags; - } - - public static class ExternalizableIssue implements Externalizable { - String uuid, severity, message, author; - int line; - List tags; - - @Override - public void writeExternal(ObjectOutput out) throws IOException { - out.writeUTF(uuid); - out.writeUTF(severity); - out.writeUTF(message); - out.writeUTF(author); - out.writeInt(line); - - // write number of tags then tags - out.writeByte(tags.size()); - for (String tag : tags) { - out.writeUTF(tag); - } - } - - @Override - public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { - throw new UnsupportedOperationException(); - } - } - - /** - * You can this benchmark with maven command-line (see run.sh) or by executing this method - * in IDE - */ - public static void main(String[] args) throws RunnerException { - Options opt = new OptionsBuilder() - .include(SerializationBenchmark.class.getSimpleName()) - .build(); - new Runner(opt).run(); - } -} diff --git a/microbenchmark-template/src/test/java/org/sonar/microbenchmark/SerializationBenchmarkTest.java b/microbenchmark-template/src/test/java/org/sonar/microbenchmark/SerializationBenchmarkTest.java deleted file mode 100644 index 33f42438932..00000000000 --- a/microbenchmark-template/src/test/java/org/sonar/microbenchmark/SerializationBenchmarkTest.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonar.microbenchmark; - -import org.apache.commons.io.FileUtils; -import org.junit.Before; -import org.junit.Test; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.OutputStream; -import java.util.zip.Deflater; - -public class SerializationBenchmarkTest { - - SerializationBenchmark benchmark = new SerializationBenchmark(); - - @Before - public void setUp() throws Exception { - benchmark.setup(); - } - - @Test - public void size_of_gson_output() throws Exception { - benchmark.write_gson(); - System.out.println("GSON: " + sizeOf(benchmark.outputFile)); - System.out.println("GSON (zipped): " + sizeOf(zipFile(benchmark.outputFile))); - } - - @Test - public void size_of_protobuf_output() throws Exception { - benchmark.write_protobuf(); - System.out.println("Protocol Buffers: " + sizeOf(benchmark.outputFile)); - System.out.println("Protocol Buffers (zipped): " + sizeOf(zipFile(benchmark.outputFile))); - } - - @Test - public void size_of_serializable_output() throws Exception { - benchmark.write_serializable(); - System.out.println("java.io.Serializable: " + sizeOf(benchmark.outputFile)); - System.out.println("java.io.Serializable (zipped): " + sizeOf(zipFile(benchmark.outputFile))); - } - - @Test - public void size_of_externalizable_output() throws Exception { - benchmark.write_externalizable(); - System.out.println("java.io.Externalizable: " + sizeOf(benchmark.outputFile)); - System.out.println("java.io.Externalizable (zipped): " + sizeOf(zipFile(benchmark.outputFile))); - } - - @Test - public void size_of_kryo_output() throws Exception { - benchmark.write_kryo(); - System.out.println("Kryo: " + sizeOf(benchmark.outputFile)); - System.out.println("Kryo (zipped): " + sizeOf(zipFile(benchmark.outputFile))); - } - - private String sizeOf(File file) { - return FileUtils.byteCountToDisplaySize(FileUtils.sizeOf(file)); - } - - private File zipFile(File input) throws Exception { - File zipFile = new File(input.getAbsolutePath() + ".zip"); - Deflater deflater = new Deflater(); - byte[] content = FileUtils.readFileToByteArray(input); - deflater.setInput(content); - try (OutputStream outputStream = new FileOutputStream(zipFile)) { - deflater.finish(); - byte[] buffer = new byte[1024]; - while (!deflater.finished()) { - int count = deflater.deflate(buffer); // returns the generated code... index - outputStream.write(buffer, 0, count); - } - } - deflater.end(); - - return zipFile; - } -} diff --git a/pom.xml b/pom.xml index ae356ad3e6a..c7bc0bce6d9 100644 --- a/pom.xml +++ b/pom.xml @@ -1448,14 +1448,6 @@ - - - includeMicrobenchmarkModule - - microbenchmark-template - - -