From 429a652eebb78b8a3e25c02c82dcc19a6d2f32c5 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Wed, 2 Sep 2015 11:04:01 -0700 Subject: [PATCH] Improve array KVO performance a bit --- shared_realm.cpp | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/shared_realm.cpp b/shared_realm.cpp index 6acd7593..8f3e416b 100644 --- a/shared_realm.cpp +++ b/shared_realm.cpp @@ -193,14 +193,7 @@ public: } else if (o->kind == kind) { if (kind == ColumnInfo::Kind::Remove) { - // Shift the index to compensate for already-removed indices - for (auto i : o->indices) { - if (i <= index) - ++index; - else - break; - } - o->indices.add(index); + o->indices.add_shifted(index); } else if (kind == ColumnInfo::Kind::Insert) { o->indices.insert_at(index);