[Mono-dev] Question about performance improvement in C#
Felipe Almeida Lessa
felipe.lessa at gmail.com
Sun Apr 16 10:34:38 EDT 2006
Em Dom, 2006-04-16 às 07:18 -0700, Rusmin Susanto escreveu:
>
> What should I do to bring the performance closer to C (of course I wan
> to keep the class and operators)?
AFAIK the "+" operator always works on pairs, so you would need to
create a method.
I'd suggest creating a class method like
static MyArray Sum(MyArray[] arrays) {
MyArray result = MyArray(get_size_from_other_array);
do_your_for_loop_here_summing_on_result;
return result;
}
So
A = (B + C + D + E + F)/2.5;
would become
A = MyArray.Sum(new MyArray[] {B, C, D, E, F})/2.5;
Yes, I know, it's uglier.
HTH,
--
Felipe.
More information about the Mono-devel-list
mailing list