Skip to content

Commit 298416c

Browse files
committed
CkArray: Reorder ckDestroy to avoid extraneous move
CkArray::deleteElt calls pop_back when removing from the local element vector, so follow the same access pattern when destroying the elements to avoid an unnecessary move in deleteElt.
1 parent 1856e8f commit 298416c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/ck-core/ckarray.C

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1770,9 +1770,9 @@ void CkArray::ckDestroy()
17701770
locMgr->setDuringDestruction(true);
17711771

17721772
// ckDestroy deletes the CkMigratable, which also removes it from this vector
1773-
while (localElemVec.size())
1773+
while (!localElemVec.empty())
17741774
{
1775-
localElemVec.front()->ckDestroy();
1775+
localElemVec.back()->ckDestroy();
17761776
}
17771777

17781778
locMgr->deleteManager(CkGroupID(thisProxy), this);

0 commit comments

Comments
 (0)