Return-Path: X-Original-To: apmail-incubator-hama-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-hama-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D63C59C8E for ; Sun, 20 May 2012 19:35:44 +0000 (UTC) Received: (qmail 40104 invoked by uid 500); 20 May 2012 19:35:44 -0000 Delivered-To: apmail-incubator-hama-commits-archive@incubator.apache.org Received: (qmail 40087 invoked by uid 500); 20 May 2012 19:35:44 -0000 Mailing-List: contact hama-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: hama-dev@incubator.apache.org Delivered-To: mailing list hama-commits@incubator.apache.org Received: (qmail 40079 invoked by uid 99); 20 May 2012 19:35:44 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 20 May 2012 19:35:44 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 20 May 2012 19:35:43 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 1FCFF23889E0; Sun, 20 May 2012 19:35:23 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1340816 - /incubator/hama/trunk/graph/src/main/java/org/apache/hama/graph/GraphJobRunner.java Date: Sun, 20 May 2012 19:35:22 -0000 To: hama-commits@incubator.apache.org From: tjungblut@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120520193523.1FCFF23889E0@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: tjungblut Date: Sun May 20 19:35:22 2012 New Revision: 1340816 URL: http://svn.apache.org/viewvc?rev=1340816&view=rev Log: Improve performance a bit Modified: incubator/hama/trunk/graph/src/main/java/org/apache/hama/graph/GraphJobRunner.java Modified: incubator/hama/trunk/graph/src/main/java/org/apache/hama/graph/GraphJobRunner.java URL: http://svn.apache.org/viewvc/incubator/hama/trunk/graph/src/main/java/org/apache/hama/graph/GraphJobRunner.java?rev=1340816&r1=1340815&r2=1340816&view=diff ============================================================================== --- incubator/hama/trunk/graph/src/main/java/org/apache/hama/graph/GraphJobRunner.java (original) +++ incubator/hama/trunk/graph/src/main/java/org/apache/hama/graph/GraphJobRunner.java Sun May 20 19:35:22 2012 @@ -49,7 +49,7 @@ import org.apache.hama.util.KeyValuePair * @param the value type of a vertex. * @param the value type of an edge. */ -public class GraphJobRunner +public final class GraphJobRunner extends BSP, VertexArrayWritable, Writable, Writable, GraphJobMessage> { @@ -99,7 +99,7 @@ public class GraphJobRunner, VertexArrayWritable, Writable, Writable, GraphJobMessage> peer) throws IOException, SyncException, InterruptedException { this.conf = peer.getConfiguration(); @@ -165,7 +165,7 @@ public class GraphJobRunner, VertexArrayWritable, Writable, Writable, GraphJobMessage> peer) throws IOException, SyncException, InterruptedException { @@ -275,21 +275,18 @@ public class GraphJobRunner, VertexArrayWritable, Writable, Writable, GraphJobMessage> peer) throws IOException { GraphJobMessage msg = null; - Map> msgMap = new HashMap>(); + final Map> msgMap = new HashMap>(); while ((msg = peer.getCurrentMessage()) != null) { // either this is a vertex message or a directive that must be read as map if (msg.isVertexMessage()) { - VERTEX_ID vertexID = (VERTEX_ID) msg.getVertexId(); - VERTEX_VALUE value = (VERTEX_VALUE) msg.getVertexValue(); - if (msgMap.containsKey(vertexID)) { - LinkedList msgs = msgMap.get(vertexID); - msgs.add(value); - msgMap.put(vertexID, msgs); - } else { - LinkedList msgs = new LinkedList(); - msgs.add(value); + final VERTEX_ID vertexID = (VERTEX_ID) msg.getVertexId(); + final VERTEX_VALUE value = (VERTEX_VALUE) msg.getVertexValue(); + LinkedList msgs = msgMap.get(vertexID); + if (msgs == null) { + msgs = new LinkedList(); msgMap.put(vertexID, msgs); } + msgs.add(value); } else if (msg.isMapMessage()) { for (Entry e : msg.getMap().entrySet()) { VERTEX_ID vertexID = (VERTEX_ID) e.getKey(); @@ -412,7 +409,7 @@ public class GraphJobRunner pair as a result */ @Override - public void cleanup( + public final void cleanup( BSPPeer, VertexArrayWritable, Writable, Writable, GraphJobMessage> peer) throws IOException { for (Entry> e : vertices @@ -432,23 +429,23 @@ public class GraphJobRunner