M
Mike Copeland
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
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