Slower than Python

simendsjo simendsjo at gmail.com
Fri Mar 1 12:58:08 PST 2013


On Friday, 1 March 2013 at 20:50:15 UTC, Andrei Alexandrescu 
wrote:
> On 3/1/13 3:30 PM, cvk012c wrote:
>> Tried to port my SIP parser from Python to D to boost 
>> performance
>> but got opposite result.
>> I created a simple test script which splits SIP REGISTER 
>> message
>> 10 million times. Python version takes about 14 seconds to
>> execute, D version is about 23 seconds which is 1.6 times 
>> slower.
>> I used DMD 2.062 and compiled my script with options -release 
>> and
>> -O. I used Python 3.3 64 bit.
>> I ran both scripts on the same hardware with Windows 7 64.
>
> Add -inline to the options.
>
> Andrei

--noboundscheck can also help if you don't mind missing the 
safety net.

$ rdmd -O -release sip
22 secs, 977 ms, 299 μs, and 8 hnsecs
$ rdmd -O -release -inline sip
12 secs, 245 ms, 567 μs, and 9 hnsecs
$ rdmd -O -release -inline -noboundscheck sip
10 secs, 171 ms, 209 μs, and 9 hnsecs


More information about the Digitalmars-d mailing list