I have a ByteArray I'm using as a buffer for incoming bytes
from a socket. I'm searching through this ByteArray for two
specific patterns (2byte head/end of Jpegs) and then reading off
those bytes/shifting the bytearray. It seems that the copying and
shifting (reading the array over itself) are not CPU intensive;
However stepping through the byteArray is eating up 30% of my CPU
by itself! It's important to note that while this byteArray does
grow, it grows within a constraint since I am moving data off of it
quickly - so it's not because the array is just getting longer.
I've tried as many caching tricks as I could think of so I don't
have to traversal the byte array that often, but does anyone know
what could be causing this?