From bae553fc2214564aef462c992d970b59cebeb0e0 Mon Sep 17 00:00:00 2001 From: Max Neunhoeffer Date: Thu, 7 Nov 2013 14:10:38 +0100 Subject: [PATCH] Speed up skiplist removal if many keys are equal. --- arangod/SkipLists/compare.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arangod/SkipLists/compare.h b/arangod/SkipLists/compare.h index edec05c930..2ac46517ce 100644 --- a/arangod/SkipLists/compare.h +++ b/arangod/SkipLists/compare.h @@ -424,7 +424,13 @@ static int IndexStaticMultiCompareElementElement (TRI_skiplist_multi_t* multiSki } } + // We break this tie in the key comparison by looking at the key: + compareResult = strcmp(leftElement->_document->_key,rightElement->_document->_key); + if (compareResult < 0) return TRI_SKIPLIST_COMPARE_STRICTLY_LESS; + else if (compareResult > 0) return TRI_SKIPLIST_COMPARE_STRICTLY_GREATER; + // This will actually never be reached since the keys can only be + // the same if the documents are, which has been checked above. return defaultEqual; }