Tuesday, December 3, 2013

Building a Large Container

Newsgroup: comp.lang.c++

Subject: Building a Large Container

From: mrc2323@...

Date: Mon, 2 Dec 2013 17:16:01 -0700



One of my applications running very slowly, due to high volume of

data. I'm currently using an STL map to store the data, and I'm trying

to convert to STL vector for processing.

The basic operation is that I could be loading some of the container

from one source (or not), but then I am definitely loading data from a

second source - and modifying existing information if it came from the

first source. The data is accessed by an integer scalar variable (see

"bibNum", below). Here's the (new) data structure:



typedef struct ChipRec

{

int bibNum; // Bib#

int dbeAge, ndfAge, gruAge;

char dbeGender, ndfGender, gruGender;

char dbeRCode, ndfRCode, gruRCode;

bool timeWritten, dbAdd;

bool dbeMatched, ndfMatched, gruMatched;

time_t startDelta;

time_t clockTime;

string dbeName, gruName;

string strAddress, strCity, strDoB;

[etc.]

} ChipData;

extern ChipData chipWork;

typedef vector<ChipRec> CRVect;

extern CRVect chipVect;

extern CRVect::iterator chipIter;



I planned to sort my container and use a binary search to determine

if I was adding a new object of modifying an existing one. That

technique won't work, as I'd have to sort the container each time I add

an object (very slow!). The binary search won't help me, because it

doesn't return an iterator to the matched object for possible

modification.

It seems using an STL vector isn't a solution...8<{{ The STL map

works, but for 30,000 objects takes about 20 minutes to go through this

process.

Am I missing something (a different container, perhaps) that would

support my application in an efficient way? Thoughts? TIA



---

This email is free from viruses and malware because avast! Antivirus protection is active.

http://www.avast.com









via Usenet Forums - Usenet Search,Free Usenet - comp.lang.c++ http://www.pocketbinaries.com/usenet-forums/showthread.php?141643-Building-a-Large-Container&goto=newpost

View all the progranning help forums at:

http://www.pocketbinaries.com/usenet-forums/forumdisplay.php?128-Coding-forums

No comments:

Post a Comment