Downsizing memory requirements by better struct packing

This commit is contained in:
DennisOSRM 2011-12-10 18:26:33 +01:00
parent 3a984668d6
commit ec3bcb43a8
2 changed files with 18 additions and 23 deletions

View File

@ -40,11 +40,8 @@ private:
parent = p;
}
};
#ifdef _MANYCORES
typedef BinaryHeap< NodeID, NodeID, int, _HeapData, DenseStorage<NodeID, NodeID> > _Heap;
#else
typedef BinaryHeap< NodeID, NodeID, int, _CleanupHeapData > _Heap;
#endif
struct _ThreadData {
_Heap* _heapForward;
_Heap* _heapBackward;
@ -52,8 +49,7 @@ private:
_heapBackward = new _Heap(nodes);
_heapForward = new _Heap(nodes);
}
~_ThreadData()
{
~_ThreadData() {
delete _heapBackward;
delete _heapForward;
}
@ -65,13 +61,13 @@ public:
NodeID source;
NodeID target;
struct EdgeData {
NodeID via;
unsigned nameID;
int distance;
bool shortcut;
bool forward;
bool backward;
short turnInstruction;
NodeID via;
unsigned nameID;
int distance;
short turnInstruction;
bool shortcut:1;
bool forward:1;
bool backward:1;
} data;
//sorts by source and other attributes

View File

@ -41,16 +41,15 @@ or see http://www.gnu.org/licenses/agpl.txt.
class Contractor {
private:
struct _EdgeBasedContractorEdgeData {
unsigned distance;
unsigned originalEdges;
unsigned via;
unsigned nameID;
bool shortcut;
bool forward;
bool backward;
short turnInstruction;
unsigned distance;
unsigned originalEdges;
unsigned via;
unsigned nameID;
short turnInstruction;
bool shortcut:1;
bool forward:1;
bool backward:1;
} data;
struct _HeapData {
@ -107,7 +106,7 @@ public:
edge.data.distance = (std::max)((int)i->weight(), 1 );
assert( edge.data.distance > 0 );
#ifndef NDEBUG
#ifdef NDEBUG
if ( edge.data.distance > 24 * 60 * 60 * 10 ) {
std::cout << "Edge Weight too large -> May lead to invalid CH" << std::endl;
continue;