Simple performance question from a newcomer

dextorious via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Feb 23 12:03:30 PST 2016


On Tuesday, 23 February 2016 at 11:10:40 UTC, ixid wrote:
> On Monday, 22 February 2016 at 15:43:23 UTC, dextorious wrote:
>> I do have to wonder, however, about the default settings of 
>> dub in this case. Having gone through its documentation, I 
>> might still not have guessed to try the compiler options you 
>> provided, thereby losing out on a 2-3x performance 
>> improvement. What build options did you use in your dub.json 
>> that it managed to translate to the correct compiler switches?
>
> Your experience is exactly what the D community needs to get 
> right. You've come in as an interested user with patience and 
> initially D has offered slightly disappointing performance for 
> both technical reasons and because of the different compilers. 
> You've gotten to the right place in the end but we need point A 
> to point B to be a lot smoother and more obvious so more people 
> get a good initial impression of D.
>
> Every D user thread seems to go like this- someone starts with 
> DMD, they then struggle a little and hopefully get LDC working 
> with a list of slightly obscure compiler switches offered. A 
> standard algorithm performs disappointingly for somewhat valid 
> technical reasons and more clunky alternatives are then 
> deployed. We really need to standard algorithms to be fast and 
> perhaps have separate ones for perfect technical accuracy.
>
> What are your thoughts on D now? What would have helped you get 
> to the right place much faster?

Personally, I think a few aspects of documentation for the 
various compilers, dub and possibly the dlang.org website itself 
could be improved, if accessibility is considered important. For 
instance, just to take my journey with trying out D as an 
example, I can immediately list a few points where I 
misunderstood or failed to find relevant information:

1. While the dlang.org website does a good job presenting the 
three compilers side by side with a short pro/con list for each 
and does mention that DMD produces slower code, I did not at 
first expect the difference to be half an order of magnitude or 
more. In retrospect, after reading the forums and learning about 
how each compiler works, this is quite obvious, but the initial 
impression was misleading.

2. The LDC compiler gave me a few issues during setup, 
particularly on Windows. The binaries supplied are dynamically 
linked against the MSVS2015 runtime (and will fail on any other 
system) and seem to require a full Visual Studio installation. I 
assume there are good reasons for this (though I hope in the 
future a more widely usable version could be made available), but 
the fact itself could be made clearer on the download page (it 
can be found after some searching on the D wiki and the forums).

3. The documentation for the dub package is useful, but somewhat 
difficult to read due to how it is structured and does not seem 
complete. For instance, I am still not sure how to make it pass 
the -O5 switch to the LDC2 compiler and the impression I got from 
the documentation is that explicit manual switches can only be 
supplied for the DMD compiler. It says that when using other 
compilers, the relevant switches are automatically translated to 
appropriate options for GDC/LDC, but no further details are 
supplied and no matter what options I set for the DMD compiler, 
using --compiler=ldc2 only yields -O and not -O5. For the moment, 
I'm compiling my code and managing dependencies manually like I 
would in C++, which is just fine for me personally, but does 
leave a slightly disappointing impression about what is 
apparently considered a semi-official package manager for the D 
language.

Of course, this is just my anecdotal experience and should not be 
taken as major criticism. It may be that I missed something or 
did not do enough research. Certainly, some amount of adjustment 
is to be expected when learning a new language, but there does 
seem to be some room for improvement.


More information about the Digitalmars-d-learn mailing list