You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2017/01/24 13:36:36 UTC

ignite git commit: ignite-3477 Try compare keys faster.

Repository: ignite
Updated Branches:
  refs/heads/ignite-3477-cmp [created] 7887e0448


ignite-3477 Try compare keys faster.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/7887e044
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/7887e044
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/7887e044

Branch: refs/heads/ignite-3477-cmp
Commit: 7887e0448f2b5996ca859b47544d5372a4817104
Parents: 4db65d2
Author: sboikov <sb...@gridgain.com>
Authored: Tue Jan 24 16:36:27 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Jan 24 16:36:27 2017 +0300

----------------------------------------------------------------------
 .../cache/IgniteCacheOffheapManagerImpl.java       | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/7887e044/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
index 5b788fc..047df48 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
@@ -60,6 +60,7 @@ import org.apache.ignite.internal.util.GridAtomicLong;
 import org.apache.ignite.internal.util.GridCloseableIteratorAdapter;
 import org.apache.ignite.internal.util.GridEmptyCloseableIterator;
 import org.apache.ignite.internal.util.GridSpinBusyLock;
+import org.apache.ignite.internal.util.GridUnsafe;
 import org.apache.ignite.internal.util.lang.GridCloseableIterator;
 import org.apache.ignite.internal.util.lang.GridCursor;
 import org.apache.ignite.internal.util.lang.GridIterator;
@@ -1357,7 +1358,21 @@ public class IgniteCacheOffheapManagerImpl extends GridCacheManagerAdapter imple
 
                         addr += 5; // Skip length and type byte.
 
-                        for (int i = 0; i < len; i++) {
+                        int words = len / 8;
+
+                        for (int i = 0; i < words; i++) {
+                            int off = i * 8;
+
+                            long b1 = PageUtils.getLong(addr, off);
+                            long b2 = GridUnsafe.getLong(bytes, GridUnsafe.BYTE_ARR_OFF + off);
+
+                            int cmp = Long.compare(b1, b2);
+
+                            if (cmp != 0)
+                                return cmp;
+                        }
+
+                        for (int i = words * 8; i < len; i++) {
                             byte b1 = PageUtils.getByte(addr, i);
                             byte b2 = bytes[i];