H
hg
Hello,
I'm reading a sequence of 123000 records from a database which needs
to be indexed into a std::map for further processing.
Currently I've found that this process can take up to 30 seconds to
perform on a modern system with 3400 MHz cpu and 1 gb ram. I would
like to cut this time down.
I've verified the actual data reading part to take less then 10
seconds which means that the map is taking about 2/3 of the time.
while (R.Read())
{
MonthlyStat.m_UsageMap[R.GetString(0)].m_Map1[(time_t)
R.GetInt(1)] = R.GetInt(2);
MonthlyStat.m_UsageMap[R.GetString(0)].m_Map2[(time_t)
R.GetInt(1)] = R.GetInt(4);
MonthlyStat.m_UsageMap[R.GetString(0)].m_Map3[(time_t)
R.GetInt(1)] = R.GetInt(3);
}
It doesn't seem to be possible to resize the map in order to allocate
memory for more items at the same time. I think that could certainly
help on speed.
Any suggestions are welcome.
Thanks.
-- Henrik
I'm reading a sequence of 123000 records from a database which needs
to be indexed into a std::map for further processing.
Currently I've found that this process can take up to 30 seconds to
perform on a modern system with 3400 MHz cpu and 1 gb ram. I would
like to cut this time down.
I've verified the actual data reading part to take less then 10
seconds which means that the map is taking about 2/3 of the time.
while (R.Read())
{
MonthlyStat.m_UsageMap[R.GetString(0)].m_Map1[(time_t)
R.GetInt(1)] = R.GetInt(2);
MonthlyStat.m_UsageMap[R.GetString(0)].m_Map2[(time_t)
R.GetInt(1)] = R.GetInt(4);
MonthlyStat.m_UsageMap[R.GetString(0)].m_Map3[(time_t)
R.GetInt(1)] = R.GetInt(3);
}
by std::string and then by time_t.From the code above one can see that I have 4 maps which are indexed
It doesn't seem to be possible to resize the map in order to allocate
memory for more items at the same time. I think that could certainly
help on speed.
Any suggestions are welcome.
Thanks.
-- Henrik