+++ /dev/null
-Template for quickly write micro-benchmarks with JMH
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.sonarsource.sonarqube</groupId>
- <artifactId>sonarqube</artifactId>
- <version>6.0-SNAPSHOT</version>
- </parent>
- <artifactId>microbenchmark-template</artifactId>
- <packaging>jar</packaging>
-
- <dependencies>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>sonar-batch-protocol</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>com.esotericsoftware</groupId>
- <artifactId>kryo-shaded</artifactId>
- <version>3.0.0</version>
- </dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>sonar-plugin-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>sonar-db</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>com.google.code.gson</groupId>
- <artifactId>gson</artifactId>
- </dependency>
- <dependency>
- <groupId>org.openjdk.jmh</groupId>
- <artifactId>jmh-core</artifactId>
- <version>${jmh.version}</version>
- </dependency>
- <dependency>
- <groupId>org.openjdk.jmh</groupId>
- <artifactId>jmh-generator-annprocess</artifactId>
- <version>${jmh.version}</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>sonar-testing-harness</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <jmh.version>1.5.1</jmh.version>
- <uberjar.name>microbenchmark</uberjar.name>
- </properties>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-shade-plugin</artifactId>
- <version>2.2</version>
- <executions>
- <execution>
- <phase>package</phase>
- <goals>
- <goal>shade</goal>
- </goals>
- <configuration>
- <finalName>${uberjar.name}</finalName>
- <transformers>
- <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
- <mainClass>org.openjdk.jmh.Main</mainClass>
- </transformer>
- </transformers>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
-</project>
+++ /dev/null
-#!/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 $*
+++ /dev/null
-/*
- * 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<FileSourceDb.Line> 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();
- }
-}
+++ /dev/null
-/*
- * 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();
- }
-}
+++ /dev/null
-/*
- * 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<String> tags;
- }
-
- public static class ExternalizableIssue implements Externalizable {
- String uuid, severity, message, author;
- int line;
- List<String> 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();
- }
-}
+++ /dev/null
-/*
- * 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;
- }
-}
</properties>
</profile>
- <profile>
- <!-- add microbenchmarks module to IDE -->
- <id>includeMicrobenchmarkModule</id>
- <modules>
- <module>microbenchmark-template</module>
- </modules>
- </profile>
-
<profile>
<!--
check if maven dependencies have vulnerabilities listed in CVE