Downsizing memory requirements by better struct packing
This commit is contained in:
parent
3a984668d6
commit
ec3bcb43a8
@ -40,11 +40,8 @@ private:
|
|||||||
parent = p;
|
parent = p;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
#ifdef _MANYCORES
|
|
||||||
typedef BinaryHeap< NodeID, NodeID, int, _HeapData, DenseStorage<NodeID, NodeID> > _Heap;
|
|
||||||
#else
|
|
||||||
typedef BinaryHeap< NodeID, NodeID, int, _CleanupHeapData > _Heap;
|
typedef BinaryHeap< NodeID, NodeID, int, _CleanupHeapData > _Heap;
|
||||||
#endif
|
|
||||||
struct _ThreadData {
|
struct _ThreadData {
|
||||||
_Heap* _heapForward;
|
_Heap* _heapForward;
|
||||||
_Heap* _heapBackward;
|
_Heap* _heapBackward;
|
||||||
@ -52,8 +49,7 @@ private:
|
|||||||
_heapBackward = new _Heap(nodes);
|
_heapBackward = new _Heap(nodes);
|
||||||
_heapForward = new _Heap(nodes);
|
_heapForward = new _Heap(nodes);
|
||||||
}
|
}
|
||||||
~_ThreadData()
|
~_ThreadData() {
|
||||||
{
|
|
||||||
delete _heapBackward;
|
delete _heapBackward;
|
||||||
delete _heapForward;
|
delete _heapForward;
|
||||||
}
|
}
|
||||||
@ -65,13 +61,13 @@ public:
|
|||||||
NodeID source;
|
NodeID source;
|
||||||
NodeID target;
|
NodeID target;
|
||||||
struct EdgeData {
|
struct EdgeData {
|
||||||
NodeID via;
|
NodeID via;
|
||||||
unsigned nameID;
|
unsigned nameID;
|
||||||
int distance;
|
int distance;
|
||||||
bool shortcut;
|
short turnInstruction;
|
||||||
bool forward;
|
bool shortcut:1;
|
||||||
bool backward;
|
bool forward:1;
|
||||||
short turnInstruction;
|
bool backward:1;
|
||||||
} data;
|
} data;
|
||||||
|
|
||||||
//sorts by source and other attributes
|
//sorts by source and other attributes
|
||||||
|
@ -41,16 +41,15 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
|||||||
class Contractor {
|
class Contractor {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
struct _EdgeBasedContractorEdgeData {
|
struct _EdgeBasedContractorEdgeData {
|
||||||
unsigned distance;
|
unsigned distance;
|
||||||
unsigned originalEdges;
|
unsigned originalEdges;
|
||||||
unsigned via;
|
unsigned via;
|
||||||
unsigned nameID;
|
unsigned nameID;
|
||||||
bool shortcut;
|
short turnInstruction;
|
||||||
bool forward;
|
bool shortcut:1;
|
||||||
bool backward;
|
bool forward:1;
|
||||||
short turnInstruction;
|
bool backward:1;
|
||||||
} data;
|
} data;
|
||||||
|
|
||||||
struct _HeapData {
|
struct _HeapData {
|
||||||
@ -107,7 +106,7 @@ public:
|
|||||||
|
|
||||||
edge.data.distance = (std::max)((int)i->weight(), 1 );
|
edge.data.distance = (std::max)((int)i->weight(), 1 );
|
||||||
assert( edge.data.distance > 0 );
|
assert( edge.data.distance > 0 );
|
||||||
#ifndef NDEBUG
|
#ifdef NDEBUG
|
||||||
if ( edge.data.distance > 24 * 60 * 60 * 10 ) {
|
if ( edge.data.distance > 24 * 60 * 60 * 10 ) {
|
||||||
std::cout << "Edge Weight too large -> May lead to invalid CH" << std::endl;
|
std::cout << "Edge Weight too large -> May lead to invalid CH" << std::endl;
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user