Jump to page: 1 2 3
Thread overview
Post about comparing C, C++ and D performance with a real world project
6 days ago
German Diago
6 days ago
Daniel Kozak
Dec 07
user1234
Dec 09
Kagamin
Dec 09
unleashy
Dec 08
Mengu
Dec 08
Mengu
Dec 09
helxi
December 07
Hello all,

Jussi Pakkanen (one of the meson build system creators) has written a post comparing C, C++ and D. Worth a read.

http://nibblestew.blogspot.com.es/2017/12/comparing-c-c-and-d-performance-with.html

Antonio.
December 07
is there a link to source code (C++,C,D) nor compile / runtime commands used? hard to reach any conclusion without this


On Thu, Dec 7, 2017 at 1:55 AM, Antonio Corbi via Digitalmars-d <digitalmars-d@puremagic.com> wrote:
> Hello all,
>
> Jussi Pakkanen (one of the meson build system creators) has written a post comparing C, C++ and D. Worth a read.
>
> http://nibblestew.blogspot.com.es/2017/12/comparing-c-c-and-d-performance-with.html
>
> Antonio.
December 07
On Thursday, 7 December 2017 at 10:33:59 UTC, Timothee Cour wrote:
> is there a link to source code (C++,C,D) nor compile / runtime commands used? hard to reach any conclusion without this
>
>
> On Thu, Dec 7, 2017 at 1:55 AM, Antonio Corbi via Digitalmars-d <digitalmars-d@puremagic.com> wrote:
>> Hello all,
>>
>> Jussi Pakkanen (one of the meson build system creators) has written a post comparing C, C++ and D. Worth a read.
>>
>> http://nibblestew.blogspot.com.es/2017/12/comparing-c-c-and-d-performance-with.html
>>
>> Antonio.

The code is in the github repo mentioned there. It has several branches.
The application is built using meson (http://mesonbuild.com/).

Antonio
December 07
Not much helpful, still does not know which compiler flags have been used, or how I can reproduce this. It would be nice to have some shell script which will compile it and run it in a same manner as a original author

On Thu, Dec 7, 2017 at 12:35 PM, Antonio Corbi via Digitalmars-d < digitalmars-d@puremagic.com> wrote:

> On Thursday, 7 December 2017 at 10:33:59 UTC, Timothee Cour wrote:
>
>> is there a link to source code (C++,C,D) nor compile / runtime commands used? hard to reach any conclusion without this
>>
>>
>> On Thu, Dec 7, 2017 at 1:55 AM, Antonio Corbi via Digitalmars-d < digitalmars-d@puremagic.com> wrote:
>>
>>> Hello all,
>>>
>>> Jussi Pakkanen (one of the meson build system creators) has written a post comparing C, C++ and D. Worth a read.
>>>
>>> http://nibblestew.blogspot.com.es/2017/12/comparing-c-c-and- d-performance-with.html
>>>
>>> Antonio.
>>>
>>
> The code is in the github repo mentioned there. It has several branches. The application is built using meson (http://mesonbuild.com/).
>
> Antonio
>


December 07
On Thursday, December 07, 2017 09:55:56 Antonio Corbi via Digitalmars-d wrote:
> Hello all,
>
> Jussi Pakkanen (one of the meson build system creators) has written a post comparing C, C++ and D. Worth a read.
>
> http://nibblestew.blogspot.com.es/2017/12/comparing-c-c-and-d-performance-> with.html

Honestly, I find the results a bit depressing, but a lot of that probably stems from the fact that it's not idiomatic D code, and any time you do more or less direct conversions, you run the risk of things not working as efficiently due to differences in the languages involved. The author does acknowledge that, but without refactoring the code to be more idiomatic, it makes D look bad - though the fact that it does better with memory than C or C++ does make the GC look better than you'd necessarily expect. It's certainly surprising that the GC is the _good_ part of the results.

I do wonder what the results would look like with clang and ldc though, particularly since the version of gdc in Ubuntu is going to be pretty old. It might make no difference at all, or there could be a definite improvement, depending on what his code is doing and what has changed since the last gdc release.

- Jonathan M Davis

December 07
On my machine D is faster than his c++ version, so It does look good. I use his own repository so I do not know why his results are so different in my case:

his c++ version with gcc:

real 0m0,021s
user 0m0,021s
sys 0m0,000s

his D version with DMD:
real 0m0,018s
user 0m0,015s
sys 0m0,004s

his D version with GDC:
real 0m0,015s
user 0m0,006s
sys 0m0,010s

his D version with LDC:
real 0m0,030s
user 0m0,025s
sys 0m0,005s

LDC is slower because on my system it use shared phobos library, so it
takes some time to load it.
all others (gcc,gdc and dmd use static libs)

When I use shared phobos for dmd, I get
real 0m0,032s
user 0m0,024s
sys 0m0,009s










On Thu, Dec 7, 2017 at 1:00 PM, Jonathan M Davis via Digitalmars-d < digitalmars-d@puremagic.com> wrote:

> On Thursday, December 07, 2017 09:55:56 Antonio Corbi via Digitalmars-d wrote:
> > Hello all,
> >
> > Jussi Pakkanen (one of the meson build system creators) has written a post comparing C, C++ and D. Worth a read.
> >
> > http://nibblestew.blogspot.com.es/2017/12/comparing-c-c-
> and-d-performance-> with.html
>
> Honestly, I find the results a bit depressing, but a lot of that probably
> stems from the fact that it's not idiomatic D code, and any time you do
> more
> or less direct conversions, you run the risk of things not working as
> efficiently due to differences in the languages involved. The author does
> acknowledge that, but without refactoring the code to be more idiomatic, it
> makes D look bad - though the fact that it does better with memory than C
> or
> C++ does make the GC look better than you'd necessarily expect. It's
> certainly surprising that the GC is the _good_ part of the results.
>
> I do wonder what the results would look like with clang and ldc though, particularly since the version of gdc in Ubuntu is going to be pretty old. It might make no difference at all, or there could be a definite improvement, depending on what his code is doing and what has changed since the last gdc release.
>
> - Jonathan M Davis
>
>


December 07
On Thursday, 7 December 2017 at 12:00:00 UTC, Jonathan M Davis wrote:
> On Thursday, December 07, 2017 09:55:56 Antonio Corbi via Digitalmars-d wrote:
>> Hello all,
>>
>> Jussi Pakkanen (one of the meson build system creators) has written a post comparing C, C++ and D. Worth a read.
>>
>> http://nibblestew.blogspot.com.es/2017/12/comparing-c-c-and-d-performance-> with.html
>
> [...]
> I do wonder what the results would look like with clang and ldc though, particularly since the version of gdc in Ubuntu is going to be pretty old.

Yes and the GDC version also explains the 7 leaks. These are quite certainly some old druntime bugs.
December 07
On 12/7/17 6:46 AM, Daniel Kozak wrote:
> Not much helpful, still does not know which compiler flags have been used, or how I can reproduce this. It would be nice to have some shell script which will compile it and run it in a same manner as a original author

https://github.com/jpakkane/pkg-config/blob/d/meson.build

This should give an idea of the flags. Not sure exactly what it means, but I assume there's a way to increase verbosity and see exactly the flags being sent to gdc.

-Steve
December 07
So who is going to do the experiment and write the best D code to solve the problem, write the rebuttal article, and post it?

It is good to get emotion going on the email list, but without external action D gets no positive marketing.

-- 
Russel.
===========================================
Dr Russel Winder      t: +44 20 7585 2200
41 Buckmaster Road    m: +44 7770 465 077
London SW11 1EN, UK   w: www.russel.org.uk


December 07
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


On Thu, Dec 7, 2017 at 3:37 PM, Russel Winder via Digitalmars-d < digitalmars-d@puremagic.com> wrote:

> So who is going to do the experiment and write the best D code to solve the problem, write the rebuttal article, and post it?
>
> It is good to get emotion going on the email list, but without external action D gets no positive marketing.
>
> --
> Russel.
> ===========================================
> Dr Russel Winder      t: +44 20 7585 2200
> 41 Buckmaster Road    m: +44 7770 465 077
> London SW11 1EN, UK   w: www.russel.org.uk
>


« First   ‹ Prev
1 2 3