From 641c8726da825959b787eba9ad7900b0732a89b9 Mon Sep 17 00:00:00 2001
From: Christian Wulf <chw@informatik.uni-kiel.de>
Date: Mon, 16 Jun 2014 16:46:12 +0200
Subject: [PATCH] added performance results

---
 results/overhead-findings.txt                              | 6 ++++--
 .../examples/throughput/methodcall/AbstractStage.java      | 4 +++-
 .../examples/throughput/methodcall/ConsumerStage.java      | 2 +-
 .../examples/throughput/methodcall/FixedSizedPipe.java     | 5 +++++
 .../java/teetime/examples/throughput/methodcall/IPipe.java | 2 ++
 .../java/teetime/examples/throughput/methodcall/Pipe.java  | 5 +++++
 .../examples/throughput/methodcall/SingleElementPipe.java  | 7 ++++++-
 7 files changed, 26 insertions(+), 5 deletions(-)

diff --git a/results/overhead-findings.txt b/results/overhead-findings.txt
index ff309c6a..2ed967b2 100644
--- a/results/overhead-findings.txt
+++ b/results/overhead-findings.txt
@@ -19,8 +19,10 @@
 8:	1200 ns (iterative; argument/return w/o pipe)
 9:	9400 ns (executeWithPorts: queued pipe)
 10:	4900 ns (executeWithPorts: single element pipe)
+	10:	5400 ns (executeWithPorts: single element pipe; with setReschedulable() after each read)
 11: 7400 ns (executeWithPorts: fixed sized pipe)
-	11: 8600 ns (executeWithPorts: fixed sized pipe with CircularArray(int))
-	11: 8200 ns (executeWithPorts: fixed sized pipe with CircularArray(int) w/o mask)
+	11: 8600 ns (executeWithPorts: fixed sized pipe; with CircularArray(int))
+	11: 8200 ns (executeWithPorts: fixed sized pipe; with CircularArray(int) w/o mask)
+	11: 7800 ns (executeWithPorts: fixed sized pipe; with setReschedulable() after each read)
 12: 3300 ns (recursive; argument/return w/o pipe)
 13: 3300 ns (recursive; argument/return w/o pipe; w/o pipeline class)
diff --git a/src/test/java/teetime/examples/throughput/methodcall/AbstractStage.java b/src/test/java/teetime/examples/throughput/methodcall/AbstractStage.java
index c615ba1c..42b55b26 100644
--- a/src/test/java/teetime/examples/throughput/methodcall/AbstractStage.java
+++ b/src/test/java/teetime/examples/throughput/methodcall/AbstractStage.java
@@ -92,12 +92,14 @@ abstract class AbstractStage<I, O> implements StageWithPort<I, O> {
 
 		this.getOutputPort().send(element);
 
-		CommittableQueue execute;
+		// CommittableQueue execute;
+
 		do {
 			// execute = this.next().execute2(this.outputElements);
 			// execute = this.next().execute2(this.getOutputPort().pipe.getElements());
 			this.next().executeWithPorts();
 		} while (this.next().isReschedulable());
+		// } while (this.next().getInputPort().pipe.size() > 0);
 		// } while (execute.size() > 0);
 	}
 
diff --git a/src/test/java/teetime/examples/throughput/methodcall/ConsumerStage.java b/src/test/java/teetime/examples/throughput/methodcall/ConsumerStage.java
index 75c3c69e..6f5f00ed 100644
--- a/src/test/java/teetime/examples/throughput/methodcall/ConsumerStage.java
+++ b/src/test/java/teetime/examples/throughput/methodcall/ConsumerStage.java
@@ -22,7 +22,7 @@ public abstract class ConsumerStage<I, O> extends AbstractStage<I, O> {
 	public void executeWithPorts() {
 		I element = this.getInputPort().receive();
 
-		this.setReschedulable(!this.getInputPort().pipe.isEmpty());
+		this.setReschedulable(this.getInputPort().pipe.size() > 0);
 
 		this.execute5(element);
 
diff --git a/src/test/java/teetime/examples/throughput/methodcall/FixedSizedPipe.java b/src/test/java/teetime/examples/throughput/methodcall/FixedSizedPipe.java
index ded0991b..285641f6 100644
--- a/src/test/java/teetime/examples/throughput/methodcall/FixedSizedPipe.java
+++ b/src/test/java/teetime/examples/throughput/methodcall/FixedSizedPipe.java
@@ -45,4 +45,9 @@ public class FixedSizedPipe<T> implements IPipe<T> {
 		// return this.elements.get(this.lastFreeIndex - 1);
 	}
 
+	@Override
+	public int size() {
+		return this.lastFreeIndex;
+	}
+
 }
diff --git a/src/test/java/teetime/examples/throughput/methodcall/IPipe.java b/src/test/java/teetime/examples/throughput/methodcall/IPipe.java
index 431998a5..25ec061b 100644
--- a/src/test/java/teetime/examples/throughput/methodcall/IPipe.java
+++ b/src/test/java/teetime/examples/throughput/methodcall/IPipe.java
@@ -8,6 +8,8 @@ public interface IPipe<T> {
 
 	public abstract boolean isEmpty();
 
+	public abstract int size();
+
 	public abstract T readLast();
 
 }
diff --git a/src/test/java/teetime/examples/throughput/methodcall/Pipe.java b/src/test/java/teetime/examples/throughput/methodcall/Pipe.java
index 3df16ac2..2c4309af 100644
--- a/src/test/java/teetime/examples/throughput/methodcall/Pipe.java
+++ b/src/test/java/teetime/examples/throughput/methodcall/Pipe.java
@@ -59,4 +59,9 @@ public class Pipe<T> implements IPipe<T> {
 		return this.elements;
 	}
 
+	@Override
+	public int size() {
+		return this.elements.size();
+	}
+
 }
diff --git a/src/test/java/teetime/examples/throughput/methodcall/SingleElementPipe.java b/src/test/java/teetime/examples/throughput/methodcall/SingleElementPipe.java
index ac8a0e65..82cad708 100644
--- a/src/test/java/teetime/examples/throughput/methodcall/SingleElementPipe.java
+++ b/src/test/java/teetime/examples/throughput/methodcall/SingleElementPipe.java
@@ -24,7 +24,7 @@ public class SingleElementPipe<T> implements IPipe<T> {
 
 	@Override
 	public boolean isEmpty() {
-		return this.element != null;
+		return this.element == null;
 	}
 
 	@Override
@@ -32,4 +32,9 @@ public class SingleElementPipe<T> implements IPipe<T> {
 		return this.element;
 	}
 
+	@Override
+	public int size() {
+		return (this.element == null) ? 0 : 1;
+	}
+
 }
-- 
GitLab