On Friday, 1 March 2013 at 20:30:24 UTC, 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.
Is this general problem with string performance in D or just
splitter() issue?
Did anybody compared performance of D string manipulating
functions with other languages like Python,Perl,Java and C++?
I'm guessing you are building without optimization options. When
compiled with "dmd -O -inline -noboundscheck -release tmp" the D
code takes 11.1 seconds on my machine and the python script takes
16.1 seconds. You can make the D code faster by building with LDC
or GDC:
ldmd2 -O -noboundscheck -release tmp:
6.8 seconds
gdmd -O -nboundscheck -inline -release tmp:
6.1 seconds
So no, not slower than Python. I also suspect that much of the
work in the Python code is actually done by functions that are
implemented in C.