Repository: ignite
Updated Branches:
  refs/heads/ignite-2523-1 5cffa794c -> 0f282b2e6


Optimizations.


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

Branch: refs/heads/ignite-2523-1
Commit: 6a48b48f6ca30a3447fe1beb0d1bb4ffd2fb0c84
Parents: 5cffa79
Author: vozerov-gridgain <[email protected]>
Authored: Mon Apr 25 12:15:19 2016 +0300
Committer: vozerov-gridgain <[email protected]>
Committed: Mon Apr 25 12:15:19 2016 +0300

----------------------------------------------------------------------
 .../dht/atomic/GridDhtAtomicCache.java          | 30 ++++++++++++++++----
 1 file changed, 24 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/6a48b48f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
index f412dfa..34533e9 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
@@ -1097,10 +1097,7 @@ public class GridDhtAtomicCache<K, V> extends 
GridDhtCacheAdapter<K, V> {
                 conflictRmvVer = ctx.versions().next(dcId);
         }
 
-        // TODO: Optimize - no array allocs!
-        CacheEntryPredicate[] filters = CU.filterArray(filter);
-
-        if (conflictPutVal == null && conflictRmvVer == null && 
!isFastMap(filters, op)) {
+        if (conflictPutVal == null && conflictRmvVer == null && 
!isFastMap(filter, op)) {
             return new GridNearAtomicSingleUpdateFuture(
                 ctx,
                 this,
@@ -1135,7 +1132,7 @@ public class GridDhtAtomicCache<K, V> extends 
GridDhtCacheAdapter<K, V> {
                 retval,
                 false,
                 opCtx != null ? opCtx.expiry() : null,
-                filters,
+                CU.filterArray(filter),
                 ctx.subjectIdPerCall(null, opCtx),
                 ctx.kernalContext().job().currentTaskNameHash(),
                 opCtx != null && opCtx.skipStore(),
@@ -1153,7 +1150,28 @@ public class GridDhtAtomicCache<K, V> extends 
GridDhtCacheAdapter<K, V> {
      * @return {@code True} if fast-map.
      */
     public boolean isFastMap(CacheEntryPredicate[] filters, GridCacheOperation 
op) {
-        return F.isEmpty(filters) && op != TRANSFORM && 
ctx.config().getWriteSynchronizationMode() == FULL_SYNC &&
+        return F.isEmpty(filters) && isFastMap0(op);
+    }
+
+    /**
+     * Whether this is fast-map operation.
+     *
+     * @param filter Filter.
+     * @param op Operation.
+     * @return {@code True} if fast-map.
+     */
+    public boolean isFastMap(@Nullable CacheEntryPredicate filter, 
GridCacheOperation op) {
+        return filter == null && isFastMap0(op);
+    }
+
+    /**
+     * Internal fast-map routine.
+     *
+     * @param op Operation.
+     * @return Result.
+     */
+    private boolean isFastMap0(GridCacheOperation op) {
+        return op != TRANSFORM && ctx.config().getWriteSynchronizationMode() 
== FULL_SYNC &&
             ctx.config().getAtomicWriteOrderMode() == CLOCK &&
             !(ctx.writeThrough() && ctx.config().getInterceptor() != null);
     }

Reply via email to