Skip to content
Snippets Groups Projects
Commit 349651e5 authored by Christian Wulf's avatar Christian Wulf
Browse files

added performance results

parent d715cdbc
Branches
Tags
No related merge requests found
...@@ -19,8 +19,10 @@ ...@@ -19,8 +19,10 @@
8: 1200 ns (iterative; argument/return w/o pipe) 8: 1200 ns (iterative; argument/return w/o pipe)
9: 9400 ns (executeWithPorts: queued pipe) 9: 9400 ns (executeWithPorts: queued pipe)
10: 4900 ns (executeWithPorts: single element 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: 7400 ns (executeWithPorts: fixed sized pipe)
11: 8600 ns (executeWithPorts: fixed sized pipe with CircularArray(int)) 11: 8600 ns (executeWithPorts: fixed sized pipe; with CircularArray(int))
11: 8200 ns (executeWithPorts: fixed sized pipe with CircularArray(int) w/o mask) 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) 12: 3300 ns (recursive; argument/return w/o pipe)
13: 3300 ns (recursive; argument/return w/o pipe; w/o pipeline class) 13: 3300 ns (recursive; argument/return w/o pipe; w/o pipeline class)
...@@ -92,12 +92,14 @@ abstract class AbstractStage<I, O> implements StageWithPort<I, O> { ...@@ -92,12 +92,14 @@ abstract class AbstractStage<I, O> implements StageWithPort<I, O> {
this.getOutputPort().send(element); this.getOutputPort().send(element);
CommittableQueue execute; // CommittableQueue execute;
do { do {
// execute = this.next().execute2(this.outputElements); // execute = this.next().execute2(this.outputElements);
// execute = this.next().execute2(this.getOutputPort().pipe.getElements()); // execute = this.next().execute2(this.getOutputPort().pipe.getElements());
this.next().executeWithPorts(); this.next().executeWithPorts();
} while (this.next().isReschedulable()); } while (this.next().isReschedulable());
// } while (this.next().getInputPort().pipe.size() > 0);
// } while (execute.size() > 0); // } while (execute.size() > 0);
} }
......
...@@ -22,7 +22,7 @@ public abstract class ConsumerStage<I, O> extends AbstractStage<I, O> { ...@@ -22,7 +22,7 @@ public abstract class ConsumerStage<I, O> extends AbstractStage<I, O> {
public void executeWithPorts() { public void executeWithPorts() {
I element = this.getInputPort().receive(); I element = this.getInputPort().receive();
this.setReschedulable(!this.getInputPort().pipe.isEmpty()); this.setReschedulable(this.getInputPort().pipe.size() > 0);
this.execute5(element); this.execute5(element);
......
...@@ -45,4 +45,9 @@ public class FixedSizedPipe<T> implements IPipe<T> { ...@@ -45,4 +45,9 @@ public class FixedSizedPipe<T> implements IPipe<T> {
// return this.elements.get(this.lastFreeIndex - 1); // return this.elements.get(this.lastFreeIndex - 1);
} }
@Override
public int size() {
return this.lastFreeIndex;
}
} }
...@@ -8,6 +8,8 @@ public interface IPipe<T> { ...@@ -8,6 +8,8 @@ public interface IPipe<T> {
public abstract boolean isEmpty(); public abstract boolean isEmpty();
public abstract int size();
public abstract T readLast(); public abstract T readLast();
} }
...@@ -59,4 +59,9 @@ public class Pipe<T> implements IPipe<T> { ...@@ -59,4 +59,9 @@ public class Pipe<T> implements IPipe<T> {
return this.elements; return this.elements;
} }
@Override
public int size() {
return this.elements.size();
}
} }
...@@ -24,7 +24,7 @@ public class SingleElementPipe<T> implements IPipe<T> { ...@@ -24,7 +24,7 @@ public class SingleElementPipe<T> implements IPipe<T> {
@Override @Override
public boolean isEmpty() { public boolean isEmpty() {
return this.element != null; return this.element == null;
} }
@Override @Override
...@@ -32,4 +32,9 @@ public class SingleElementPipe<T> implements IPipe<T> { ...@@ -32,4 +32,9 @@ public class SingleElementPipe<T> implements IPipe<T> {
return this.element; return this.element;
} }
@Override
public int size() {
return (this.element == null) ? 0 : 1;
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment