From c17ecd0761377ba11067ccfdd917c01aa8e7ed7c Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Fri, 19 Apr 2013 16:27:21 +1000 Subject: Using std::fill instead of a loop is much faster. As much as 4x on a large block. --- src/SplitVector.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/SplitVector.h') diff --git a/src/SplitVector.h b/src/SplitVector.h index 0ccf6c9f4..502101b6c 100644 --- a/src/SplitVector.h +++ b/src/SplitVector.h @@ -174,8 +174,7 @@ public: } RoomFor(insertLength); GapTo(position); - for (int i = 0; i < insertLength; i++) - body[part1Length + i] = v; + std::fill(&body[part1Length], &body[part1Length + insertLength], v); lengthBody += insertLength; part1Length += insertLength; gapLength -= insertLength; -- cgit v1.2.3