[Swift-commit] r6355 - in branches/faster/src/org/griphyn/vdl/karajan: . lib

hategan at ci.uchicago.edu hategan at ci.uchicago.edu
Fri Mar 8 12:58:55 CST 2013


Author: hategan
Date: 2013-03-08 12:58:55 -0600 (Fri, 08 Mar 2013)
New Revision: 6355

Modified:
   branches/faster/src/org/griphyn/vdl/karajan/Pair.java
   branches/faster/src/org/griphyn/vdl/karajan/lib/AppStageouts.java
Log:
slightly more memory efficient appStageouts()

Modified: branches/faster/src/org/griphyn/vdl/karajan/Pair.java
===================================================================
--- branches/faster/src/org/griphyn/vdl/karajan/Pair.java	2013-03-08 18:56:01 UTC (rev 6354)
+++ branches/faster/src/org/griphyn/vdl/karajan/Pair.java	2013-03-08 18:58:55 UTC (rev 6355)
@@ -22,16 +22,23 @@
 
 import java.util.AbstractList;
 
-public class Pair extends AbstractList<Object> {
-	private Object[] elements = new Object[2];
+public class Pair<T> extends AbstractList<T> {
+	private T o1, o2;
 
-	public Pair(Object o1, Object o2) {
-		elements[0] = o1;
-		elements[1] = o2;
+	public Pair(T o1, T o2) {
+		this.o1 = o1;
+		this.o2 = o2;
 	}
 
-	public Object get(int index) {
-		return elements[index];
+    public T get(int index) {
+	    switch (index) {
+	        case 0:
+	            return o1;
+	        case 1:
+	            return o2;
+	        default:
+	            throw new IndexOutOfBoundsException();
+	    }
 	}
 
 	public int size() {

Modified: branches/faster/src/org/griphyn/vdl/karajan/lib/AppStageouts.java
===================================================================
--- branches/faster/src/org/griphyn/vdl/karajan/lib/AppStageouts.java	2013-03-08 18:56:01 UTC (rev 6354)
+++ branches/faster/src/org/griphyn/vdl/karajan/lib/AppStageouts.java	2013-03-08 18:58:55 UTC (rev 6355)
@@ -31,6 +31,7 @@
 import org.globus.cog.karajan.analyzer.ChannelRef;
 import org.globus.cog.karajan.analyzer.Signature;
 import org.globus.cog.karajan.compiled.nodes.InternalFunction;
+import org.griphyn.vdl.karajan.Pair;
 import org.griphyn.vdl.mapping.AbsFile;
 import org.griphyn.vdl.mapping.DSHandle;
 import org.griphyn.vdl.mapping.Path;
@@ -76,9 +77,6 @@
     }
     
     private List<String> makeList(String s1, String s2) {
-        List<String> l = new LinkedList<String>();
-        l.add(s1);
-        l.add(s2);
-        return l;
+        return new Pair<String>(s1, s2);
     }
 }




More information about the Swift-commit mailing list