A little late mail: if you are ultimately interested in speed, Compile for the purpose of compiling C seems to be about twice as fast as the fastest solution published so far ( Tally - Sign ):
fn = Compile[{{l, _Real, 1}}, Module[{sumneg = 0}, Do[If[i < 0, sumneg++], {i, l}]; EvenQ[sumneg]], CompilationTarget -> "C", RuntimeOptions -> "Speed"];
The following are the timings on my machine:
In[85]:= lst = RandomReal[{-2, 2}, 5000000]; s = t = q = {}; Do[AppendTo[s, EvenQ@Total@UnitStep[-lst]], {10}]; // Timing Do[AppendTo[t, EvenQ[-1 /. Rule @@@ Tally@Sign[lst]]], {10}]; // Timing Do[AppendTo[q, fn [lst]], {10}]; // Timing s == t == q Out[87]= {0.813, Null} Out[88]= {0.515, Null} Out[89]= {0.266, Null} Out[90]= True
Leonid Shifrin
source share