Post about comparing C, C++ and D performance with a real world project
Daniel Kozak
kozzi11 at gmail.com
Thu Dec 7 22:39:44 UTC 2017
The other slowdown is caused by concatenation. Because std::string += is
more simillar to std.array.(Ref)Appender
Dne 7. 12. 2017 11:33 odp. napsal uživatel "Daniel Kozak" <kozzi11 at gmail.com
>:
> Yes, it reuse the same pointer. But it still a little bit slower than
> accessing stack memory
>
> Dne 7. 12. 2017 11:04 odp. napsal uživatel "Iain Buclaw via Digitalmars-d"
> <digitalmars-d at puremagic.com>:
>
> On 7 December 2017 at 20:56, Steven Schveighoffer via Digitalmars-d
> <digitalmars-d at puremagic.com> wrote:
> > On 12/7/17 1:26 PM, Daniel Kozak wrote:
> >>
> >> This is not about write the best D code. It is about similar code to
> >> perform same. However when I looked at the D code it is not good port of
> >> C/C++. He made many mistakes which make it slower than C/C++
> counterpart.
> >> One example is read_one_line function:
> >> C++: https://github.com/jpakkane/pkg-config/blob/cpp/parse.cpp#L60
> >> D: https://github.com/jpakkane/pkg-config/blob/d/parse.d#L57
> >
> >
> > Wow, interesting that D uses less memory with that continue new char[1]
> in
> > there!
> >
>
> I would have thought that it just reuses the same pointer to the GC on
> each loop.
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20171207/1ba63135/attachment.html>
More information about the Digitalmars-d
mailing list