Slower than Python
Don
turnyourkidsintocash at nospam.com
Mon Mar 4 03:12:21 PST 2013
On Monday, 4 March 2013 at 03:58:20 UTC, deadalnix wrote:
> On Monday, 4 March 2013 at 03:20:57 UTC, jerro wrote:
>>> Maybe it is time to look at the python implementation and see
>>> why it is faster.
>>
>> It isn't faster:
>>
>> $ time python3 test.py
>>
>> real 0m14.217s
>> user 0m14.209s
>> sys 0m0.004s
>> $ gdmd -O -inline -release -noboundscheck test
>> $ time ./test
>>
>> real 0m5.323s
>> user 0m5.312s
>> sys 0m0.008s
>>
>> D code here uses the same string as the python code, not the
>> one in cvk012c's D code.
>
> Using noboundcheck isn't fair as you give up on safety, so you
> are not equivalent to python either.
But that does suggest that the main problem is that DMD has very
little optimization aimed at reducing the number of bounds checks
required.
More information about the Digitalmars-d
mailing list