Skip to content

Commit 61c2fca

Browse files
committed
DEV-574 #time 5m more efficient removal of time stamp per byte from list
1 parent 9e495e6 commit 61c2fca

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

ShimmerDriver/src/main/java/com/shimmerresearch/bluetooth/ShimmerBluetooth.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1311,10 +1311,8 @@ protected void discardBufferBytesToNextPacket(){
13111311
mByteArrayOutputStream.reset();
13121312
mByteArrayOutputStream.write(bTemp, offset, bTemp.length-offset); //this will throw the first byte away
13131313
if(mEnablePCTimeStamps) {
1314-
for (int i=0;i<offset;i++)
1315-
{
1316-
mListofPCTimeStamps.remove(0);
1317-
}
1314+
// Remove first `offset` elements from the original list (destructive, modifies same list)
1315+
mListofPCTimeStamps.subList(0, offset).clear();
13181316
}
13191317
consolePrintLn("Throw Bytes " + UtilShimmer.bytesToHexStringWithSpacesFormatted(Arrays.copyOfRange(bTemp, 0, offset)));
13201318
}

0 commit comments

Comments
 (0)