tez-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rbalamo...@apache.org
Subject git commit: TEZ-1512. VertexImpl.getTask(int) can be CPU intensive when lots of tasks are present in the vertex
Date Thu, 28 Aug 2014 08:13:23 GMT
Repository: tez
Updated Branches:
  refs/heads/master db732b2fb -> ddef389a9


TEZ-1512. VertexImpl.getTask(int) can be CPU intensive when lots of tasks are present in the
vertex


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

Branch: refs/heads/master
Commit: ddef389a976793da397856f397398bdddc8db123
Parents: db732b2
Author: Rajesh Balamohan <rbalamohan@apache.org>
Authored: Thu Aug 28 13:41:04 2014 +0530
Committer: Rajesh Balamohan <rbalamohan@apache.org>
Committed: Thu Aug 28 13:41:04 2014 +0530

----------------------------------------------------------------------
 .../apache/tez/dag/app/dag/impl/VertexImpl.java  | 19 +------------------
 1 file changed, 1 insertion(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tez/blob/ddef389a/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/VertexImpl.java
----------------------------------------------------------------------
diff --git a/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/VertexImpl.java b/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/VertexImpl.java
index 361260e..b6e6a50 100644
--- a/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/VertexImpl.java
+++ b/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/VertexImpl.java
@@ -717,24 +717,7 @@ public class VertexImpl implements org.apache.tez.dag.app.dag.Vertex,
 
   @Override
   public Task getTask(int taskIndex) {
-    readLock.lock();
-    try {
-      // does it matter to create a duplicate list for efficiency
-      // instead of traversing the map
-      // local assign to LinkedHashMap to ensure that sequential traversal
-      // assumption is satisfied
-      LinkedHashMap<TezTaskID, Task> taskList = tasks;
-      int i=0;
-      for(Map.Entry<TezTaskID, Task> entry : taskList.entrySet()) {
-        if(taskIndex == i) {
-          return entry.getValue();
-        }
-        ++i;
-      }
-      return null;
-    } finally {
-      readLock.unlock();
-    }
+    return getTask(TezTaskID.getInstance(this.vertexId, taskIndex));
   }
 
   @Override


Mime
View raw message