← Back to team overview

kicad-developers team mailing list archive

[PATCH 14/16] Reserve appropriate space in local vector

 

This is just a speed optimization -- preallocate four items to avoid reallocations.
---
 eeschema/sch_line.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/eeschema/sch_line.cpp b/eeschema/sch_line.cpp
index 050b786..6d86b5d 100644
--- a/eeschema/sch_line.cpp
+++ b/eeschema/sch_line.cpp
@@ -347,6 +347,7 @@ bool SCH_LINE::MergeOverlap( SCH_LINE* aLine )
     if( colinear )
     {
         std::vector <wxPoint*> candidates;
+        candidates.reserve(4);
         candidates.push_back( &m_start );
         candidates.push_back( &m_end );
         candidates.push_back( &aLine->m_start );

Follow ups

References