From 33e15d6aa9d5cfd1a51f740e2e743b9f9b5ffb0b Mon Sep 17 00:00:00 2001 From: "jan.reininghaus" Date: Tue, 23 Apr 2013 15:27:41 +0000 Subject: performance improvement for vector_vector git-svn-id: https://phat.googlecode.com/svn/trunk@42 8e3bb3c2-eed4-f18f-5264-0b6c94e6926d --- include/phat/representations/vector_vector.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/phat/representations/vector_vector.h b/include/phat/representations/vector_vector.h index c313c20..bdef522 100644 --- a/include/phat/representations/vector_vector.h +++ b/include/phat/representations/vector_vector.h @@ -80,8 +80,9 @@ namespace phat { void _add_to( index source, index target ) { column& source_col = matrix[ source ]; column& target_col = matrix[ target ]; - column temp_col = target_col; - target_col.clear(); + column temp_col; + target_col.swap( temp_col ); + target_col.reserve( temp_col.size() ); std::set_symmetric_difference( temp_col.begin(), temp_col.end(), source_col.begin(), source_col.end(), std::back_inserter( target_col ) ); -- cgit v1.2.3