From 17da2cfde698dab355b0d661ac189c94ab4642b6 Mon Sep 17 00:00:00 2001 From: Christian Wulf <chw@informatik.uni-kiel.de> Date: Tue, 17 Jun 2014 10:00:10 +0200 Subject: [PATCH] final static ArrayWrapper does not improve performance --- .../throughput/methodcall/FixedSizedPipe.java | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/src/test/java/teetime/examples/throughput/methodcall/FixedSizedPipe.java b/src/test/java/teetime/examples/throughput/methodcall/FixedSizedPipe.java index 285641f6..f1288355 100644 --- a/src/test/java/teetime/examples/throughput/methodcall/FixedSizedPipe.java +++ b/src/test/java/teetime/examples/throughput/methodcall/FixedSizedPipe.java @@ -2,8 +2,35 @@ package teetime.examples.throughput.methodcall; public class FixedSizedPipe<T> implements IPipe<T> { + // private static final class ArrayWrapper2<T> { + // + // private final T[] elements; + // + // // private int lastFreeIndex; + // + // @SuppressWarnings("unchecked") + // public ArrayWrapper2(final int initialCapacity) { + // super(); + // this.elements = (T[]) new Object[initialCapacity]; + // } + // + // public final T get(final int index) { + // return this.elements[index]; + // } + // + // public final void put(final int index, final T element) { + // this.elements[index] = element; + // } + // + // public final int getCapacity() { + // return this.elements.length; + // } + // + // } + + @SuppressWarnings("unchecked") private final T[] elements = (T[]) new Object[4]; - // private final ArrayWrapper<T> elements = new ArrayWrapper<T>(2); + // private final ArrayWrapper2<T> elements = new ArrayWrapper2<T>(2); private int lastFreeIndex; public static <T> void connect(final OutputPort<T> sourcePort, final InputPort<T> targetPort) { -- GitLab