Fast multidimensional Arrays

Daniel Kozak via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Aug 29 07:54:06 PDT 2016


Dne 29.8.2016 v 16:43 Steinhagelvoll via Digitalmars-d-learn napsal(a):

> On Monday, 29 August 2016 at 13:59:15 UTC, Daniel Kozak wrote:
>> Dne 29.8.2016 v 11:53 Steinhagelvoll via Digitalmars-d-learn napsal(a):
>>
>>> [...]
>> It is unfair to compare different backend:
>>
>> gfortran -O3 -o test test.f90
>> [kozak at dajinka ~]$ time ./test
>>
>> real    0m2.072s
>> user    0m2.053s
>> sys    0m0.013s
>>
>> gdc -O3 -o test test.d
>> [kozak at dajinka ~]$ time ./test
>>
>> real    0m1.655s
>> user    0m1.640s
>> sys    0m0.010s
>>
>> Obviously ifort can use some special instruction on your CPU
>
> This seems to be it. I also implemented it in C++ (because gfortran 
> isn't the main focus of GNU) and this is the result:
>
> $ ./cpp_test_clang
> elapsed time 1.12785
> $ ./cpp_test_gpp
> elapsed time 1.24206
> $ ./cpp_test_intel
> elapsed time 0.298331
>
> It is quite surprising that there is this much of a difference, even 
> when all run sequential. I believe this might be specific to this 
> small problem.

with gcc you can try enable some optimalizations: g++ -O3 -march=native 
-o test test.cpp



More information about the Digitalmars-d-learn mailing list