Add a Reserve method to RangeVector and RangeDataVector. Have the

DWARFCallFrameInfo method which returns a RangeVector pre-size the
vector based on the number of entries it will be adding insted of
growing the vector as items are added.

llvm-svn: 177773
This commit is contained in:
Jason Molenda 2013-03-22 22:43:14 +00:00
parent 0827e97700
commit ee7593fbff
2 changed files with 16 additions and 2 deletions

View File

@ -588,7 +588,13 @@ namespace lldb_private {
{
m_entries.clear();
}
void
Reserve (typename Collection::size_type size)
{
m_entries.resize (size);
}
bool
IsEmpty () const
{
@ -1137,7 +1143,13 @@ namespace lldb_private {
{
m_entries.clear();
}
void
Reserve (typename Collection::size_type size)
{
m_entries.resize (size);
}
bool
IsEmpty () const
{

View File

@ -109,6 +109,8 @@ DWARFCallFrameInfo::GetFunctionAddressAndSizeVector (FunctionAddressAndSizeVecto
{
GetFDEIndex();
const size_t count = m_fde_index.GetSize();
function_info.Clear();
function_info.Reserve(count);
for (size_t i = 0; i < count; ++i)
{
const FDEEntryMap::Entry *func_offset_data_entry = m_fde_index.GetEntryAtIndex (i);