Zaher, Ben, all,
To test this I have separated the solutions into separate methods (not one method with a lot of ifs, but 10 methods with a different name and (in other aspects) the same signature). I then altered the benchmark so that the contestants method is passed as a delegate. The second thing I did was alter the benchmark size from 1e5 to 1e6 (what it was). I did not change bawrs' solution (ToArray/ToList).
Below I have gathered 4 different timings
I agree that keeping the methods separate is cleaner and yields different results than combining them. From the results I suspect that you have done your measurements with the 1e5 benchmark size, but I cannot be sure.
Friday to Sunday I will probably not be able to reply (I'm going off for a long weekend).
Cheers,
Renze.
(A) Separate methods (delegates), benchmark size 1e6
1 - bawr, AvgRatio: 24,667, SD: 0,621, WorstCase: 23,670
2 - Zaher, AvgRatio: 21,096, SD: 0,318, WorstCase: 20,623
3 - Renze, AvgRatio: 18,332, SD: 0,294, WorstCase: 17,752
4 - SoftwareBender, AvgRatio: 14,956, SD: 0,321, WorstCase: 14,465
5 - V_Tom_R, AvgRatio: 13,270, SD: 0,145, WorstCase: 13,121
6 - Mihai, AvgRatio: 13,208, SD: 0,200, WorstCase: 12,991
7 - c6c, AvgRatio: 10,290, SD: 0,516, WorstCase: 8,948
8 - MoustafaS, AvgRatio: 9,560, SD: 0,133, WorstCase: 9,294
9 - ErwinReid, AvgRatio: 9,232, SD: 0,150, WorstCase: 9,039
10 - aus1, AvgRatio: 6,081, SD: 0,139, WorstCase: 5,776
(B) Separate methods (delegates), benchmark size 1e5
1 - bawr, AvgRatio: 22,135, SD: 0,580, WorstCase: 20,942
2 - Zaher, AvgRatio: 19,785, SD: 0,406, WorstCase: 18,805
3 - Renze, AvgRatio: 14,846, SD: 0,629, WorstCase: 13,735
4 - SoftwareBender, AvgRatio: 13,241, SD: 0,197, WorstCase: 12,847
5 - V_Tom_R, AvgRatio: 12,305, SD: 0,376, WorstCase: 11,519
6 - Mihai, AvgRatio: 11,489, SD: 0,622, WorstCase: 9,942
7 - c6c, AvgRatio: 10,318, SD: 0,476, WorstCase: 9,118
8 - ErwinReid, AvgRatio: 9,355, SD: 0,340, WorstCase: 8,676
9 - MoustafaS, AvgRatio: 9,223, SD: 0,397, WorstCase: 8,400
10 - aus1, AvgRatio: 5,835, SD: 0,145, WorstCase: 5,502
(C) One method (ifs), benchmark size 1e6
1 - bawr, AvgRatio: 27,362, SD: 0,516, WorstCase: 26,433
2 - Zaher, AvgRatio: 21,361, SD: 0,052, WorstCase: 21,277
3 - SoftwareBender, AvgRatio: 14,435, SD: 0,194, WorstCase: 14,088
4 - Mihai, AvgRatio: 13,951, SD: 0,207, WorstCase: 13,561
5 - Renze, AvgRatio: 12,300, SD: 0,375, WorstCase: 11,871
6 - V_Tom_R, AvgRatio: 11,188, SD: 1,290, WorstCase: 8,921
7 - c6c, AvgRatio: 10,487, SD: 0,269, WorstCase: 9,992
8 - MoustafaS, AvgRatio: 10,357, SD: 0,294, WorstCase: 9,978
9 - ErwinReid, AvgRatio: 10,043, SD: 0,171, WorstCase: 9,756
10 - aus1, AvgRatio: 6,261, SD: 0,188, WorstCase: 5,862
(D) One method (ifs), benchmark size 1e5
1 - bawr, AvgRatio: 22,148, SD: 0,244, WorstCase: 21,606
2 - Zaher, AvgRatio: 16,193, SD: 0,188, WorstCase: 15,801
3 - SoftwareBender, AvgRatio: 12,877, SD: 0,172, WorstCase: 12,608
4 - Renze, AvgRatio: 12,520, SD: 0,195, WorstCase: 12,196
5 - Mihai, AvgRatio: 11,774, SD: 0,111, WorstCase: 11,592
6 - V_Tom_R, AvgRatio: 11,299, SD: 0,029, WorstCase: 11,237
7 - c6c, AvgRatio: 10,211, SD: 0,152, WorstCase: 9,903
8 - MoustafaS, AvgRatio: 9,940, SD: 0,929, WorstCase: 7,564
9 - ErwinReid, AvgRatio: 9,511, SD: 0,326, WorstCase: 8,882
10 - aus1, AvgRatio: 5,851, SD: 0,102, WorstCase: 5,599