update primitiveCollections to 0.2

This commit is contained in:
2021-04-04 14:15:01 +02:00
parent a1b4c7006d
commit 9ff3bbc90d
3 changed files with 5 additions and 13 deletions

View File

@@ -26,7 +26,7 @@ ext {
lib_log4j2_core = "org.apache.logging.log4j:log4j-core:${version_log4j2}"
lib_log4j2_slf4j_impl = "org.apache.logging.log4j:log4j-slf4j-impl:${version_log4j2}"
lib_primitive_collections='org.lucares:primitiveCollections:0.1.20201115124106'
lib_primitive_collections='org.lucares:primitiveCollections:0.2'
lib_spring_boot_log4j2="org.springframework.boot:spring-boot-starter-log4j2:${version_spring}"
lib_spring_boot_test="org.springframework.boot:spring-boot-starter-test:${version_spring}"
@@ -60,6 +60,7 @@ subprojects {
// the repositories for external depenencies
repositories {
mavenLocal()
maven {
url 'https://repo.lucares.de/'
content { includeGroup "org.lucares" }

View File

@@ -58,10 +58,6 @@ public class CumulativeDistributionCustomAggregator implements CustomAggregator
}
}
public long getMaxValue() {
return maxValue;
}
public Percentiles getPercentiles() {
return percentiles;
}
@@ -86,18 +82,15 @@ public class CumulativeDistributionCustomAggregator implements CustomAggregator
@Override
public void addValue(final long epochMilli, final long value) {
map.compute(value, 0, l -> l + 1);
map.compute(value, 0, (__, l) -> l + 1);
totalValues++;
}
public Percentiles getPercentiles() {
final long start = System.nanoTime();
final ToPercentiles toPercentiles = new ToPercentiles(totalValues);
toPercentiles.collect(map);
final Percentiles result = toPercentiles.getPercentiles();
System.out.println("getPercentiles took: " + (System.nanoTime() - start) / 1_000_000.0 + " ms");
return result;
}
@@ -107,10 +100,8 @@ public class CumulativeDistributionCustomAggregator implements CustomAggregator
final char separator = ',';
final char newline = '\n';
final long start = System.nanoTime();
final ToPercentiles toPercentiles = new ToPercentiles(totalValues);
toPercentiles.collect(map);
System.out.println("getAggregated took: " + (System.nanoTime() - start) / 1_000_000.0 + " ms");
final File dataFile = File.createTempFile("data", ".dat", tmpDir.toFile());
try (final Writer output = new BufferedWriter(

View File

@@ -30,7 +30,7 @@ public class HistogramAggregator implements CustomAggregator {
@Override
public void accept(final long key, final long value) {
final long bin = binWidth * (key / binWidth);
bins.compute(bin, 0, oldValue -> oldValue + value);
bins.compute(bin, 0, (__, oldValue) -> oldValue + value);
}
public LongLongHashMap getBins() {
@@ -52,7 +52,7 @@ public class HistogramAggregator implements CustomAggregator {
@Override
public void addValue(final long epochMilli, final long value) {
map.compute(value, 0, l -> l + 1);
map.compute(value, 0, (__, l) -> l + 1);
min = min < value ? min : value;
max = max > value ? max : value;
}