This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ObjectStreamAverageBenchmark { | |
@State(Scope.Thread) | |
public static class BenchmarkState { | |
public ArrayList<Record> records; | |
public BenchmarkState() { | |
records = new ArrayList<>(1000000); | |
for (int i = 0; i < 1000000; i ++) | |
records.add(new Record(i, "name" + i, Math.random())); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DoubleStreamAverageBenchmark { | |
@State(Scope.Thread) | |
public static class BenchmarkState { | |
public double[] values; | |
public BenchmarkState() { | |
values = new double[1000000]; | |
for (int i = 0; i < 1000000; i ++) | |
values[i] = Math.random(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DataItemSet { | |
private long[] id; | |
private double[] metric1; | |
private double[] metric2; | |
... | |
private double[] metricN; | |
getters... | |
setters... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DataItem { | |
private long id; | |
private double metric1; | |
private double metric2; | |
... | |
private double metricN; | |
... | |
getters... | |
setters... | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ArrayList<DataItem> records; | |
..... | |
records.stream() | |
.map(Record::getMetric1) | |
.collect(Collectors.averagingDouble(d -> d)) | |
.doubleValue() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Arrays.stream(dataset.metric1) | |
.average() | |
.getAsDouble() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface EnvObservation { | |
public long getTimestamp(); | |
public void setTimeStamp(long timeStamp); | |
public double getTemperature(); | |
public void setTemperature(double temperature); | |
public double getHumidity(); | |
public void setHumidity(double humidity); | |
public double getWindSpeed(); | |
public void setWindSpeed(double windSpeed); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.thekirschners.emplacements.column; | |
import java.util.Arrays; | |
import java.util.Iterator; | |
import java.util.Spliterator; | |
import java.util.Spliterators; | |
import java.util.function.Consumer; | |
import java.util.stream.DoubleStream; | |
import java.util.stream.LongStream; | |
import java.util.stream.Stream; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Calendar; | |
import java.util.function.Consumer; | |
/** | |
* Created by emilkirschner on 13/02/17. | |
*/ | |
class BaseBenchmarkState { | |
protected void generateTime(Consumer<Long> consumer) { | |
for (int month = Calendar.JANUARY; month <= Calendar.DECEMBER; month++) { | |
for (int day = 0; day <= 28; day++) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RestController | |
@RequestMapping(path = "/api/files") | |
public class ReactiveUploadResource { | |
Logger LOGGER = LoggerFactory.getLogger(ReactiveUploadResource.class); | |
/** | |
* upload handler method, mapped to POST. Like any file upload handler it consumes MULTIPART_FORM_DATA. | |
* Produces a JSON respomse | |
* | |
* @param parts a flux providing all part contained in the MULTIPART_FORM_DATA request |
OlderNewer