Post about comparing C, C++ and D performance with a real world project

Steven Schveighoffer schveiguy at yahoo.com
Fri Dec 8 15:40:08 UTC 2017


On 12/7/17 8:11 PM, Mengu wrote:
> On Thursday, 7 December 2017 at 22:39:44 UTC, Daniel Kozak wrote:
>> The other slowdown is caused by concatenation. Because std::string += 
>> is more simillar to std.array.(Ref)Appender
> 
> wait, i thought appenders performed better than concatenation. is that 
> not true or did i just misunderstand your post?
> 

You misunderstood. Appender is faster than ~= to a straight array, 
because it doesn't have to do any opaque lookups in the GC to see if it 
needs to reallocate -- all the information is right there.

Daniel's point was that Appender is more akin to std::string (which 
doesn't have the benefit of having language-defined array operaions). If 
the blogger used Appender, he would have had better performance.

-Steve


More information about the Digitalmars-d mailing list