Commit 116a97e0 authored by Moritz's avatar Moritz
Browse files

Initial commit

parents
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>WIABenchmark</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding/<project>=UTF-8
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.8
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
<!--
Copyright (c) 2014, Oracle America, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of Oracle nor the names of its contributors may be used
to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGE.
-->
<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>
<groupId>de.h-da.stud.wia1</groupId>
<artifactId>WIABenchmark</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<name>JMH benchmark sample: Java</name>
<!--
This is the demo/sample template build script for building Java benchmarks with JMH.
Edit as needed.
-->
<dependencies>
<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>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!--
JMH version to use with this project.
-->
<jmh.version>1.20</jmh.version>
<!--
Java source/target to use for compilation.
-->
<javac.target>1.8</javac.target>
<!--
Name of the benchmark Uber-JAR to generate.
-->
<uberjar.name>benchmarks</uberjar.name>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<compilerVersion>${javac.target}</compilerVersion>
<source>${javac.target}</source>
<target>${javac.target}</target>
</configuration>
</plugin>
<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>
<filters>
<filter>
<!--
Shading signed JARs will fail without this.
http://stackoverflow.com/questions/999489/invalid-signature-file-when-attempting-to-run-a-jar
-->
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.1</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.1</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
</plugin>
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.3</version>
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.17</version>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
package de.h_da.stud.wia1;
import de.h_da.stud.wia1.MyBenchmark.DefaultState;
import org.openjdk.jmh.annotations.*;
import java.util.LinkedList;
import java.util.TreeSet;
import java.util.concurrent.TimeUnit;
@State(Scope.Benchmark)
@BenchmarkMode(Mode.AverageTime)
@Warmup(iterations = 1)
@Measurement(iterations = 3)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public class MyBenchmark {
public static final int N = 100000;
@State(Scope.Thread)
public static class MyState {
LinkedList<Integer> mList = null;
TreeSet<Integer> mTree = null;
@Setup(Level.Trial)
public void doSetup() {
System.out.println("Do setup");
mList = new LinkedList<Integer>();
mTree = new TreeSet<Integer>();
}
@TearDown(Level.Trial)
public void doTearDown() {
System.out.println("Do TearDown");
}
}
@State(Scope.Thread)
public static class DefaultState {
LinkedList<Integer> mList = null;
TreeSet<Integer> mTree = null;
@Setup(Level.Invocation)
public void doSetup() {
mList = new LinkedList<Integer>();
mTree = new TreeSet<Integer>();
for(int i = 0; i < N; i++) {
mList.add(i);
}
for(int i = 0; i < N; i++) {
mTree.add(i);
}
//System.out.println("Do setup");
}
@TearDown(Level.Trial)
public void doTearDown() {
System.out.println("Do teardown");
}
}
@Benchmark
public void createLinkedList(MyState state) {
for(int i = 0; i < N; i++) {
state.mList.add(i);
}
}
@Benchmark
public void createTree(MyState state) {
for(int i = 0; i < N; i++) {
state.mTree.add(i);
}
}
@Benchmark
public void findMiddleList(DefaultState state) {
state.mList.contains(N/2);
}
@Benchmark
public void findLastTree(DefaultState state) {
state.mTree.contains(N-1);
}
@Benchmark
public void deleteMiddleList(DefaultState state) {
state.mList.remove(N/2);
}
@Benchmark
public void deleteLastTree(DefaultState state) {
state.mTree.remove(N-1);
}
}
JMH S 29 de.h_da.stud.wia1.MyBenchmark S 58 de.h_da.stud.wia1.generated.MyBenchmark_createTree_jmhTest S 10 createTree S 11 AverageTime E A 1 1 1 E I 1 1 E E I 1 3 E E E E E E E E E U 12 MILLISECONDS E E
JMH S 29 de.h_da.stud.wia1.MyBenchmark S 60 de.h_da.stud.wia1.generated.MyBenchmark_findLastTree_jmhTest S 12 findLastTree S 11 AverageTime E A 1 1 1 E I 1 1 E E I 1 3 E E E E E E E E E U 12 MILLISECONDS E E
JMH S 29 de.h_da.stud.wia1.MyBenchmark S 64 de.h_da.stud.wia1.generated.MyBenchmark_deleteMiddleList_jmhTest S 16 deleteMiddleList S 11 AverageTime E A 1 1 1 E I 1 1 E E I 1 3 E E E E E E E E E U 12 MILLISECONDS E E
JMH S 29 de.h_da.stud.wia1.MyBenchmark S 62 de.h_da.stud.wia1.generated.MyBenchmark_findMiddleList_jmhTest S 14 findMiddleList S 11 AverageTime E A 1 1 1 E I 1 1 E E I 1 3 E E E E E E E E E U 12 MILLISECONDS E E
JMH S 29 de.h_da.stud.wia1.MyBenchmark S 62 de.h_da.stud.wia1.generated.MyBenchmark_deleteLastTree_jmhTest S 14 deleteLastTree S 11 AverageTime E A 1 1 1 E I 1 1 E E I 1 3 E E E E E E E E E U 12 MILLISECONDS E E
JMH S 29 de.h_da.stud.wia1.MyBenchmark S 64 de.h_da.stud.wia1.generated.MyBenchmark_createLinkedList_jmhTest S 16 createLinkedList S 11 AverageTime E A 1 1 1 E I 1 1 E E I 1 3 E E E E E E E E E U 12 MILLISECONDS E E
dontinline,*.*_all_jmhStub
dontinline,*.*_avgt_jmhStub
dontinline,*.*_sample_jmhStub
dontinline,*.*_ss_jmhStub
dontinline,*.*_thrpt_jmhStub
inline,de/h_da/stud/wia1/MyBenchmark$DefaultState.doSetup
inline,de/h_da/stud/wia1/MyBenchmark$DefaultState.doTearDown
inline,de/h_da/stud/wia1/MyBenchmark$MyState.doSetup
inline,de/h_da/stud/wia1/MyBenchmark$MyState.doTearDown
inline,de/h_da/stud/wia1/MyBenchmark.createLinkedList
inline,de/h_da/stud/wia1/MyBenchmark.createTree
inline,de/h_da/stud/wia1/MyBenchmark.deleteLastTree
inline,de/h_da/stud/wia1/MyBenchmark.deleteMiddleList
inline,de/h_da/stud/wia1/MyBenchmark.findLastTree
inline,de/h_da/stud/wia1/MyBenchmark.findMiddleList
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment