Let me understand; you are currently using a sequence of 32-bit values for the chromosome. Are we talking about DNA chromosomes or neuroevolutionary algorithmic chromosomes?
If it is DNA, you are dealing with 4 meanings; A, C, G, T. This can be encoded in 2 bits, forcing the byte to contain 4 values. Your 3000-element chromosome sequence can be stored in a byte array of 750 elements; that nothing really.
Your two most expensive operations relate to and from compressed bitstream. I would recommend an enumeration with a byte key:
public enum DnaMarker : byte { A, C, G, T };
Then you go from 4 to byte with one operation:
public static byte ToByteCode(this DnaMarker[] markers) { byte output = 0; for(byte i=0;i<4;i++) output = (output << 2) + (byte)markers[i]; }
... and analyze them with something like this:
public static DnaMarker[] ToMarkers(this byte input) { var result = new byte[4]; for(byte i=0;i<4;i++) result[i] = (DnaMarker)(input - (input >> (2*(i+1)))); return result; }
You can see a slight increase in performance using four parameters (print them if necessary), and also select and use the array on the heap. But you lose the iteration, which makes the code more compact.
Now, because you are packing them into four-byte “blocks”, if the length of your sequence is not always a short four-fold, you will end up “filling” the end of your block with zero values (A). The work around this is messy, but if you have a 32-bit integer that indicates the exact number of tokens, you can simply discard everything you find in the byte stream.
Hence the endless possibilities; you can convert an array of enumerations to a string, just call ToString () on each of them, and you can also feed a string and get an array of enumerations by repeating with Enum.Parse ().
And always remember, if the memory does not have premium (usually it is not), it almost always processes data faster in a user-friendly format, and not in the most compact format. The only big exception is network transmission; if you needed to send 750 bytes versus 12K via the Internet, the obvious advantage is a smaller size.