Why 16Mib static array size limit?

Yuxuan Shui via Digitalmars-d digitalmars-d at puremagic.com
Tue Aug 16 13:03:39 PDT 2016


On Tuesday, 16 August 2016 at 19:50:14 UTC, Yuxuan Shui wrote:
> On Tuesday, 16 August 2016 at 18:46:06 UTC, Ali Çehreli wrote:
>> On 08/16/2016 10:51 AM, Johan Engelen wrote:
>> > On Tuesday, 16 August 2016 at 01:28:05 UTC, Ali Çehreli 
>> > wrote:
>> >>
>> >> With ldc2, the best option is to go with a dynamic array
>> ONLY IF you
>> >> access the elements through the .ptr property. As seen in
>> the last
>> >> result, using the [] operator on the array is about 4 times
>> slower
>> >> than that.
>> >
>> > [...]
>> >
>> > -Johan
>>
>> Thank you all. That makes sense... Agreeing that the POINTER 
>> version is applicable only in some cases, looking only at the 
>> non-POINTER cases, for ldc2, a static array is faster, making 
>> the "arbitrary" 16MiB limit a performance issue. For ldc2, 
>> static array is about 40% faster:
>>
>> [...]
>>
>> Ali
>
> Actually, the STATIC version is always faster on my machine 
> (Core i5 5200U), in both dmd and ldc2 cases

In dmd's case, the non-STATIC version seems to evaluate the loop 
condition (arr.length) **everytime**.


More information about the Digitalmars-d mailing list