Slower than Python

Steven Schveighoffer schveiguy at yahoo.com
Sat Mar 2 11:32:02 PST 2013


On Sat, 02 Mar 2013 12:17:54 -0500, Andrei Alexandrescu  
<SeeWebsiteForEmail at erdani.org> wrote:

> On 3/1/13 8:29 PM, Steven Schveighoffer wrote:
>> On Fri, 01 Mar 2013 20:05:34 -0500, cvk012c
>> <cvk012c at motorolasolutions.com> wrote:
>>
>>> In my latest version of D script I didn't use splitter at all. I used
>>> string specific indexOf function. Still result is very bad. For text
>>> based protocols, such as SIP, performance of string manipulating
>>> functions is very important. Unfortunately, looks like it is not D
>>> strongest point at this time.
>>
>> indexOf uses the same mechanism as splitter to find the separators. If
>> it doesn't improve anything, I'd say that is where the problem lies
>> (std.algorithm.find).
>
> find and indexOf on arrays are on par with handwritten loops.

This is not a personal attack, please don't take it that way.  My  
anecdotal tests with hand writing a custom splitter range to handle the  
OP's program gave me a 40% savings.  Whether it's find or not, I'm not  
sure, but there definitely is room for improvement.  Using indexOf instead  
of splitter seems to result in the same time usage, so something that is  
common between the two would be a logical choice to target.

It would be interesting to examine the assembly differences, but I haven't  
got the time right now.

-Steve


More information about the Digitalmars-d mailing list