Maximum array size

Ivan Kazmenko gassa at mail.ru
Wed Apr 26 07:58:00 PDT 2006


Dave:
>Instead of
>
>T[25_000_000] myarray;
>
>just do
>
>T[] myarray = new T[25_000_000];
>
>and that will take care of the immediate problem you describe and let 
>you get on with solving the problem.
Thanks for the verbose reply! I'll check the performance of the suggested
solution as soon as I get back home.

What I'm concerned of is the performance of the data structure. The simpler, the
faster, the better. I have a feeling that using a dynamic array adds an extra
CPU cycle or two since the additional pointer to the data is variable, not
constant; I'll check that soon. That's why I'm trying to get a working static
array solution. Languages such as C and D offer a comfortable and readable way
of writing performance critical parts of the program; it's a shame when it does
not work afterwards.

Besides, having such an undocumented feature as a 16M limit on an array length
is IMHO no good and deserves at least an explanation by someone familiar with
the dmd code.

Ivan Kazmenko.



More information about the Digitalmars-d mailing list