[Mono-list] Re: Time problems on Mono

Paolo Molaro lupus@ximian.com
Tue, 14 Dec 2004 19:28:16 +0100


On 12/13/04 Jonathan Gilbert wrote:
> Actually, my understanding is that jagged arrays tend to perform better.

That's usually the case, even on the MS runtime.

> By the way, does anyone know where mono stands with rectangular array
> optimization? In particular, is mono able to eliminate the bounds checks
> from something like this?:
> 
> int[,] array = ...;
> int sum = 0;
> for (int i=0; i < array.GetLength(0); i++)
>   for (int j=0; j < array.GetLength(1); j++)
>     sum += array[i,j];

Nope, we currently don't try to optimize this case or any other with
rectangular arrays. We do have some optimization for 2D arrays,
but just enough to get bearable performance.
Avoiding them is the right thing to do most of the time, IMHO.

lupus

-- 
-----------------------------------------------------------------
lupus@debian.org                                     debian/rules
lupus@ximian.com                             Monkeys do it better