From: Mark Slee Date: Wed, 12 Jun 2013 02:39:48 +0000 (-0700) Subject: Pedantic perf thing, flatten raw int[] list instead of List for slightly... X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=e4d0d812bf21edff41d863460761866127bdefa2;p=SugarCubes.git Pedantic perf thing, flatten raw int[] list instead of List for slightly faster iteration --- diff --git a/_PandaDriver.pde b/_PandaDriver.pde index 28701e9..6a4a3da 100644 --- a/_PandaDriver.pde +++ b/_PandaDriver.pde @@ -23,7 +23,7 @@ public class PandaDriver { private final OscMessage message; // List of point indices on the board - private final List points; + private final int[] points; // Bit for flipped status of each point index private final boolean[] flipped; @@ -34,7 +34,12 @@ public class PandaDriver { public PandaDriver(NetAddress address, Model model, int[][] channelList, int[][] flippedList) { this.address = address; message = new OscMessage("/shady/pointbuffer"); - points = buildMappedList(model, channelList); + List pointList = buildMappedList(model, channelList); + points = new int[pointList.size()]; + int i = 0; + for (int value : pointList) { + points[i++] = value; + } flipped = buildFlippedList(model, flippedList); }