From 7fc83cf8ceb90bddefe3ca48ca2b2d6c6121fe4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Gr=C3=BCninger?= Date: Sun, 17 Dec 2023 21:21:26 +0100 Subject: [PATCH] [ParU] Small performance improvement in update rowDeg std::set only inserts an element, if it does not already contain the element. Thus, we can get rid of the additional find. This was found by cppcheck. --- ParU/Source/paru_update_rowDeg.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ParU/Source/paru_update_rowDeg.cpp b/ParU/Source/paru_update_rowDeg.cpp index dd9c45cb1..d5071aabc 100644 --- a/ParU/Source/paru_update_rowDeg.cpp +++ b/ParU/Source/paru_update_rowDeg.cpp @@ -178,9 +178,10 @@ void paru_update_rowDeg(int64_t panel_num, int64_t row_end, int64_t f, //if (curCol < col2 && curCol >= col1) continue; ASSERT(curCol >= col2 || curCol < col1); - if (stl_colSet.find(curCol) == stl_colSet.end()) + auto insertResult = stl_colSet.insert(curCol); + // inserted to stl_colSet => insert to stl_newColSet + if (insertResult.second) { - stl_colSet.insert(curCol); stl_newColSet.insert(curCol); colCount++; }