recover deleted JMH tests
update gradle and other third-party libs
This commit is contained in:
40
build.gradle
40
build.gradle
@@ -1,8 +1,20 @@
|
||||
plugins {
|
||||
// usage: gradle dependencyUpdates -Drevision=release
|
||||
id "com.github.ben-manes.versions" version "0.20.0"
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
maven {
|
||||
url "https://plugins.gradle.org/m2/"
|
||||
}
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath "me.champeau.gradle:jmh-gradle-plugin:0.5.0-rc-2"
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
// usage: gradle dependencyUpdates -Drevision=release
|
||||
id "com.github.ben-manes.versions" version "0.22.0"
|
||||
}
|
||||
apply plugin: 'java'
|
||||
apply plugin: 'eclipse'
|
||||
|
||||
@@ -14,6 +26,7 @@ subprojects {
|
||||
apply plugin: 'eclipse'
|
||||
apply plugin: 'maven'
|
||||
apply plugin: 'maven-publish'
|
||||
apply plugin: 'me.champeau.gradle.jmh'
|
||||
|
||||
// java compatibility version
|
||||
sourceCompatibility = 10
|
||||
@@ -31,9 +44,9 @@ subprojects {
|
||||
uploadArchives {
|
||||
repositories {
|
||||
mavenDeployer {
|
||||
if (!project.hasProperty('mavenDeployRepo')){
|
||||
throw new IllegalStateException("Set the property 'mavenDeployRepo' to the repository URL. A good place is ~/.gradle/gradle.properties")
|
||||
}
|
||||
if (!project.hasProperty('mavenDeployRepo')){
|
||||
throw new IllegalStateException("Set the property 'mavenDeployRepo' to the repository URL. A good place is ~/.gradle/gradle.properties")
|
||||
}
|
||||
repository(url: "${mavenDeployRepo}")
|
||||
println "publishing to: ${mavenDeployRepo}"
|
||||
}
|
||||
@@ -52,16 +65,23 @@ subprojects {
|
||||
|
||||
// dependencies that all sub-projects have
|
||||
dependencies {
|
||||
testCompile 'org.junit.jupiter:junit-jupiter-api:5.4.2'
|
||||
testRuntime 'org.junit.jupiter:junit-jupiter-engine:5.4.2'
|
||||
testRuntime 'org.junit.platform:junit-platform-launcher:1.4.2' // needed by eclipse
|
||||
testCompile 'org.junit.jupiter:junit-jupiter-api:5.5.1'
|
||||
testRuntime 'org.junit.jupiter:junit-jupiter-engine:5.5.1'
|
||||
testRuntime 'org.junit.platform:junit-platform-launcher:1.5.1' // needed by eclipse
|
||||
}
|
||||
|
||||
test {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
jmh {
|
||||
//jvmArgsAppend = ""
|
||||
resultFormat = "JSON"
|
||||
//include = ['.*Union.*'] // include pattern (regular expression) for benchmarks to be executed
|
||||
//exclude = ['some regular expression'] // exclude pattern (regular expression) for benchmarks to be executed
|
||||
}
|
||||
}
|
||||
|
||||
wrapper() {
|
||||
gradleVersion = '5.4.1'
|
||||
gradleVersion = '5.6'
|
||||
}
|
||||
|
||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
||||
6
gradlew
vendored
6
gradlew
vendored
@@ -7,7 +7,7 @@
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@@ -125,8 +125,8 @@ if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin ; then
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
2
gradlew.bat
vendored
2
gradlew.bat
vendored
@@ -5,7 +5,7 @@
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem http://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
package org.lucares.collections;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
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.Scope;
|
||||
import org.openjdk.jmh.annotations.Setup;
|
||||
import org.openjdk.jmh.annotations.State;
|
||||
import org.openjdk.jmh.annotations.TearDown;
|
||||
import org.openjdk.jmh.annotations.Warmup;
|
||||
|
||||
@State(Scope.Benchmark)
|
||||
@BenchmarkMode(Mode.Throughput)
|
||||
@Warmup(iterations = 5, time = 1, timeUnit = TimeUnit.SECONDS)
|
||||
@Measurement(iterations = 5, time = 1, timeUnit = TimeUnit.SECONDS)
|
||||
@Fork(1)
|
||||
public class BenchmarkRemoveAll {
|
||||
|
||||
private IntList base = null;
|
||||
private IntList remove = null;
|
||||
|
||||
@Setup
|
||||
public void setup() throws Exception {
|
||||
|
||||
final int values = 10_000;
|
||||
base = IntList.of();
|
||||
IntStream.range(0, values).forEachOrdered(i -> base.add(i));
|
||||
base.sort();
|
||||
|
||||
remove = IntList.of();
|
||||
IntStream.range(0, 50).forEachOrdered(i -> remove.add(i));
|
||||
remove.sort();
|
||||
}
|
||||
|
||||
@TearDown
|
||||
public void tearDown() {
|
||||
base = null;
|
||||
remove = null;
|
||||
}
|
||||
|
||||
@Benchmark
|
||||
public void testRemoveAll() throws Exception {
|
||||
|
||||
final IntList tmp = base.clone();
|
||||
tmp.removeAll(remove);
|
||||
}
|
||||
|
||||
@Benchmark
|
||||
public void testRemoveAll_withRemoveIf() throws Exception {
|
||||
|
||||
final IntList tmp = base.clone();
|
||||
tmp.removeIf((val, index) -> remove.indexOf(val) >= 0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package org.lucares.collections;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
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.Scope;
|
||||
import org.openjdk.jmh.annotations.Setup;
|
||||
import org.openjdk.jmh.annotations.State;
|
||||
import org.openjdk.jmh.annotations.TearDown;
|
||||
import org.openjdk.jmh.annotations.Warmup;
|
||||
|
||||
@State(Scope.Benchmark)
|
||||
@BenchmarkMode(Mode.Throughput)
|
||||
@Warmup(iterations = 10, time = 1, timeUnit = TimeUnit.SECONDS)
|
||||
@Measurement(iterations = 5, time = 1, timeUnit = TimeUnit.SECONDS)
|
||||
@Fork(1)
|
||||
public class BenchmarkUnionIntersection {
|
||||
|
||||
private IntList aSorted = null;
|
||||
private IntList bSorted = null;
|
||||
private IntList cUnsorted = null;
|
||||
private IntList dUnsorted = null;
|
||||
|
||||
@Setup
|
||||
public void setup() throws Exception {
|
||||
|
||||
final int values = 10_000;
|
||||
aSorted = IntList.of();
|
||||
IntStream.range(0, values).forEachOrdered(aSorted::add);
|
||||
aSorted.sort();
|
||||
|
||||
bSorted = IntList.of();
|
||||
IntStream.range(0, values).forEachOrdered(bSorted::add);
|
||||
bSorted.sort();
|
||||
|
||||
cUnsorted = IntList.of();
|
||||
IntStream.range(0, values).forEachOrdered(cUnsorted::add);
|
||||
cUnsorted.shuffle();
|
||||
|
||||
dUnsorted = IntList.of();
|
||||
IntStream.range(0, values).forEachOrdered(dUnsorted::add);
|
||||
dUnsorted.shuffle();
|
||||
|
||||
}
|
||||
|
||||
@TearDown
|
||||
public void tearDown() {
|
||||
aSorted = null;
|
||||
bSorted = null;
|
||||
cUnsorted = null;
|
||||
dUnsorted = null;
|
||||
}
|
||||
|
||||
@Benchmark
|
||||
public void testUnionSortedLists() throws Exception {
|
||||
|
||||
IntList.union(aSorted, bSorted);
|
||||
}
|
||||
|
||||
@Benchmark
|
||||
public void testIntersectionSortedLists() throws Exception {
|
||||
|
||||
IntList.intersection(aSorted, bSorted);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user