Commit aa5a22ef authored by Stefan Schuhbaeck's avatar Stefan Schuhbaeck
Browse files

fix performance problem. Use FastBufferedInputStream in cache handling.

parent 31720fe8
Pipeline #135224 passed with stages
in 112 minutes and 26 seconds
{
"name" : "mf_001",
"description" : "",
"release" : "1.0",
"release" : "1.2",
"processWriters" : {
"files" : [ {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.TimestepPedestrianIdOutputFile",
......@@ -75,6 +75,8 @@
"potentialFieldResolution" : 0.1,
"obstacleGridPenalty" : 0.1,
"targetAttractionStrength" : 1.0,
"cacheType" : "NO_CACHE",
"cacheDir" : "",
"timeCostAttributes" : {
"standardDeviation" : 0.7,
"type" : "UNIT",
......@@ -10776,26 +10778,7 @@
"targetOrientationAngleThreshold" : 45.0
},
"teleporter" : null,
"attributesCar" : {
"id" : -1,
"radius" : 0.195,
"densityDependentSpeed" : false,
"speedDistributionMean" : 1.34,
"speedDistributionStandardDeviation" : 0.26,
"minimumSpeed" : 0.5,
"maximumSpeed" : 2.2,
"acceleration" : 2.0,
"footStepsToStore" : 4,
"searchRadius" : 1.0,
"angleCalculationType" : "USE_CENTER",
"targetOrientationAngleThreshold" : 45.0,
"length" : 4.5,
"width" : 1.7,
"direction" : {
"x" : 1.0,
"y" : 0.0
}
}
"attributesCar" : null
},
"eventInfos" : [ ]
}
......
{
"name" : "mf_small",
"description" : "",
"release" : "1.0",
"release" : "1.2",
"processWriters" : {
"files" : [ {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.TimestepPedestrianIdOutputFile",
......@@ -75,6 +75,8 @@
"potentialFieldResolution" : 0.3,
"obstacleGridPenalty" : 0.1,
"targetAttractionStrength" : 1.0,
"cacheType" : "NO_CACHE",
"cacheDir" : "",
"timeCostAttributes" : {
"standardDeviation" : 0.7,
"type" : "UNIT",
......@@ -3130,26 +3132,7 @@
"targetOrientationAngleThreshold" : 45.0
},
"teleporter" : null,
"attributesCar" : {
"id" : -1,
"radius" : 0.195,
"densityDependentSpeed" : false,
"speedDistributionMean" : 1.34,
"speedDistributionStandardDeviation" : 0.26,
"minimumSpeed" : 0.5,
"maximumSpeed" : 2.2,
"acceleration" : 2.0,
"footStepsToStore" : 4,
"searchRadius" : 1.0,
"angleCalculationType" : "USE_CENTER",
"targetOrientationAngleThreshold" : 45.0,
"length" : 4.5,
"width" : 1.7,
"direction" : {
"x" : 1.0,
"y" : 0.0
}
}
"attributesCar" : null
},
"eventInfos" : [ ]
}
......
{
"name" : "mf_small_simple",
"description" : "",
"release" : "1.0",
"release" : "1.2",
"processWriters" : {
"files" : [ {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.TimestepPedestrianIdOutputFile",
......@@ -75,6 +75,8 @@
"potentialFieldResolution" : 0.3,
"obstacleGridPenalty" : 0.1,
"targetAttractionStrength" : 1.0,
"cacheType" : "NO_CACHE",
"cacheDir" : "",
"timeCostAttributes" : {
"standardDeviation" : 0.7,
"type" : "UNIT",
......@@ -1969,27 +1971,8 @@
"targetOrientationAngleThreshold" : 45.0
},
"teleporter" : null,
"attributesCar" : {
"id" : -1,
"radius" : 0.195,
"densityDependentSpeed" : false,
"speedDistributionMean" : 1.34,
"speedDistributionStandardDeviation" : 0.26,
"minimumSpeed" : 0.5,
"maximumSpeed" : 2.2,
"acceleration" : 2.0,
"footStepsToStore" : 4,
"searchRadius" : 1.0,
"angleCalculationType" : "USE_CENTER",
"targetOrientationAngleThreshold" : 45.0,
"length" : 4.5,
"width" : 1.7,
"direction" : {
"x" : 1.0,
"y" : 0.0
}
}
"attributesCar" : null
},
"eventInfos" : [ ]
}
}
}
\ No newline at end of file
{
"name" : "roVerTest001",
"description" : "",
"release" : "1.0",
"release" : "1.2",
"processWriters" : {
"files" : [ {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.TimestepPedestrianIdOutputFile",
......@@ -94,6 +94,8 @@
"potentialFieldResolution" : 0.1,
"obstacleGridPenalty" : 0.1,
"targetAttractionStrength" : 1.0,
"cacheType" : "BIN_CACHE",
"cacheDir" : "roVerTest001",
"timeCostAttributes" : {
"standardDeviation" : 0.7,
"type" : "UNIT",
......@@ -269,26 +271,7 @@
"targetOrientationAngleThreshold" : 45.0
},
"teleporter" : null,
"attributesCar" : {
"id" : -1,
"radius" : 0.2,
"densityDependentSpeed" : false,
"speedDistributionMean" : 1.34,
"speedDistributionStandardDeviation" : 0.26,
"minimumSpeed" : 0.5,
"maximumSpeed" : 2.2,
"acceleration" : 2.0,
"footStepsToStore" : 4,
"searchRadius" : 1.0,
"angleCalculationType" : "USE_CENTER",
"targetOrientationAngleThreshold" : 45.0,
"length" : 4.5,
"width" : 1.7,
"direction" : {
"x" : 1.0,
"y" : 0.0
}
}
"attributesCar" : null
},
"eventInfos" : [ ]
}
......
{
"name" : "scenario001",
"description" : "",
"release" : "1.0",
"release" : "1.2",
"processWriters" : {
"files" : [ {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.TimestepPedestrianIdOutputFile",
......@@ -75,6 +75,8 @@
"potentialFieldResolution" : 0.1,
"obstacleGridPenalty" : 0.1,
"targetAttractionStrength" : 1.0,
"cacheType" : "NO_CACHE",
"cacheDir" : "",
"timeCostAttributes" : {
"standardDeviation" : 0.7,
"type" : "UNIT",
......@@ -190,26 +192,7 @@
"targetOrientationAngleThreshold" : 45.0
},
"teleporter" : null,
"attributesCar" : {
"id" : -1,
"radius" : 0.2,
"densityDependentSpeed" : false,
"speedDistributionMean" : 1.34,
"speedDistributionStandardDeviation" : 0.26,
"minimumSpeed" : 0.5,
"maximumSpeed" : 2.2,
"acceleration" : 2.0,
"footStepsToStore" : 4,
"searchRadius" : 1.0,
"angleCalculationType" : "USE_CENTER",
"targetOrientationAngleThreshold" : 45.0,
"length" : 4.5,
"width" : 1.7,
"direction" : {
"x" : 1.0,
"y" : 0.0
}
}
"attributesCar" : null
},
"eventInfos" : [ ]
}
......
{
"name" : "scenario002",
"description" : "",
"release" : "1.0",
"release" : "1.2",
"processWriters" : {
"files" : [ {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.TimestepPedestrianIdOutputFile",
......@@ -75,6 +75,8 @@
"potentialFieldResolution" : 0.1,
"obstacleGridPenalty" : 0.1,
"targetAttractionStrength" : 1.0,
"cacheType" : "NO_CACHE",
"cacheDir" : "",
"timeCostAttributes" : {
"standardDeviation" : 0.7,
"type" : "UNIT",
......@@ -267,26 +269,7 @@
"targetOrientationAngleThreshold" : 45.0
},
"teleporter" : null,
"attributesCar" : {
"id" : -1,
"radius" : 0.2,
"densityDependentSpeed" : false,
"speedDistributionMean" : 1.34,
"speedDistributionStandardDeviation" : 0.26,
"minimumSpeed" : 0.5,
"maximumSpeed" : 2.2,
"acceleration" : 2.0,
"footStepsToStore" : 4,
"searchRadius" : 1.0,
"angleCalculationType" : "USE_CENTER",
"targetOrientationAngleThreshold" : 45.0,
"length" : 4.5,
"width" : 1.7,
"direction" : {
"x" : 1.0,
"y" : 0.0
}
}
"attributesCar" : null
},
"eventInfos" : [ ]
}
......
roVer
roVer
\ No newline at end of file
package org.vadere.simulator.utils.cache;
import it.unimi.dsi.fastutil.io.FastBufferedInputStream;
import org.vadere.util.data.cellgrid.CellGrid;
import org.vadere.util.data.cellgrid.CellGridReadWriter;
import org.vadere.util.logging.Logger;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
public class CellGridBinaryCacheObject extends AbstractCacheObject implements ICellGridCacheObject {
......@@ -24,7 +25,7 @@ public class CellGridBinaryCacheObject extends AbstractCacheObject implements IC
@Override
public void initializeObjectFromCache(CellGrid object) throws CacheException {
try {
CellGridReadWriter.read(object).fromBinary(new DataInputStream(new FileInputStream(cacheLocation)));
CellGridReadWriter.read(object).fromBinary(new DataInputStream(new FastBufferedInputStream(inputStream)));
} catch (Exception e) {
throw new CacheException("Cannot load cache from CSV InputStream", e);
}
......
package org.vadere.simulator.utils.cache;
import it.unimi.dsi.fastutil.io.FastBufferedInputStream;
import org.vadere.util.data.cellgrid.CellGrid;
import org.vadere.util.data.cellgrid.CellGridReadWriter;
import org.vadere.util.logging.Logger;
......@@ -21,7 +23,7 @@ public class CellGridTxtCacheObject extends AbstractCacheObject implements ICell
@Override
public void initializeObjectFromCache(CellGrid object) throws CacheException {
try {
CellGridReadWriter.read(object).fromTextFile(inputStream);
CellGridReadWriter.read(object).fromTextFile(new FastBufferedInputStream(inputStream));
} catch (Exception e) {
throw new CacheException("Cannot load cache from TXT InputStream", e);
}
......
Markdown is supported
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