diff --git a/results/overhead-findings.txt b/results/overhead-findings.txt index ff309c6a556cc3bdc3f628945250d754f3bbc5da..2ed967b23e3c2be6852a69431090f53c03771061 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 c615ba1c9d6a397b2b6b70a1b57ffbe377970eba..42b55b262c7c33fde360ead73a86c81543129c4e 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 75c3c69ea1f0bcae87cf4bef17190b6fa8ea42d5..6f5f00edd85a5dd030618eb22934f6e11540c020 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 ded0991b72e4114e2ea48cbd2638710fab1500d8..285641f63f2c23dd7936f01535f67654d5fcd2e4 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 431998a51383c751410a20c4657d2b1537f1e4a8..25ec061b7b899fc86d700f8f5382f76ae7d3eb36 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 3df16ac259e52c49406a3558a6c217fc40d3bbe1..2c4309afbb37ecbf50b749d13c04e000f5c2b2cb 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 ac8a0e65ed103f32fb3a82f37735a185c329a815..82cad708dd0c29eed8f456f57e3d22baf9ff8060 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; + } + }