I believe the following is equivalent. It gets rid of some of the tensor copying. On my machine I'm seeing a factor of almost 3 in speed improvement.

LinearComplexityC2 = Compile[{{u, _Integer, 1}},
   Module[{len, b, c, l = 0, m = 0, bsub, mmn, oldl, oldm},
    len = Length[u];
    c = b = Join[{1}, Table[0, {len - 1}]];
    Do[
     If[OddQ[u[[n]] + Sum[c[[j + 1]]*u[[n - j]], {j, 1, l}]],
      oldl = l;
      oldm = m;
      bsub = b[[1 ;; l + 1]];
      If[2*l &lt;= n, l = n - l; m = n; b = c;];
      mmn = 1 + n - oldm;
      c[[mmn ;; mmn + oldl]] =
       Mod[c[[mmn ;; mmn + oldl]] + bsub, 2];
      ], {n, 1, len}];
    l], CompilationTarget -&gt; "C"
   ];


--- edit ---

Adding

"RuntimeOptions" -&gt; "Speed"


gives another factor of 3 or so.

--- end edit ---

Efficient implementation of a linear complexity measure of binary sequences
The fresh Fenugreek which I bought contains:
- long stems
- green leaves
- yellow leaves    

I wish to know what parts of fresh Fenugreek am I supposed to throw off before attempting to place them drying out completely?
