Kaydet (Commit) bad98d1b authored tarafından Kohei Yoshida's avatar Kohei Yoshida

Avoid expensive element position lookup twice.

This moderately improves the performance of pasting a large array
of formula cells.

Change-Id: I27a59ff348cb715df15db80693cb7d193e67ec2e
üst bb77c4b5
...@@ -1864,13 +1864,37 @@ void ScColumn::FindUsed( SCROW nStartRow, SCROW nEndRow, bool* pUsed ) const ...@@ -1864,13 +1864,37 @@ void ScColumn::FindUsed( SCROW nStartRow, SCROW nEndRow, bool* pUsed ) const
void ScColumn::StartListening( SvtListener& rLst, SCROW nRow ) void ScColumn::StartListening( SvtListener& rLst, SCROW nRow )
{ {
SvtBroadcaster* pBC = GetBroadcaster(nRow); std::pair<BCStoreType::iterator,size_t> aPos = maBroadcasters.position(nRow);
if (!pBC) BCStoreType::iterator it = aPos.first; // block position.
size_t nElemPos = aPos.second; // element position within the block.
switch (it->type)
{ {
pBC = new SvtBroadcaster; case sc::element_type_broadcaster:
maBroadcasters.set(nRow, pBC); {
// Broadcaster already exists here.
sc::custom_broadcaster_block::iterator itData = sc::custom_broadcaster_block::begin(*it->data);
std::advance(itData, nElemPos);
SvtBroadcaster* pBC = *itData;
rLst.StartListening(*pBC);
}
break;
case mdds::mtv::element_type_empty:
{
// No broadcaster exists at this position yet.
SvtBroadcaster* pBC = new SvtBroadcaster;
rLst.StartListening(*pBC);
maBroadcasters.set(it, nRow, pBC);
}
break;
default:
#if DEBUG_COLUMN_STORAGE
cout << "ScColumn::StartListening: wrong block type encountered in the broadcaster storage." << endl;
cout.flush();
abort();
#else
;
#endif
} }
rLst.StartListening(*pBC);
} }
void ScColumn::MoveListeners( SvtBroadcaster& rSource, SCROW nDestRow ) void ScColumn::MoveListeners( SvtBroadcaster& rSource, SCROW nDestRow )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment