Optimizations and performance

Dave via Digitalmars-d digitalmars-d at puremagic.com
Thu Jun 9 08:57:02 PDT 2016


On Thursday, 9 June 2016 at 15:44:04 UTC, Ola Fosheim Grøstad 
wrote:
> On Thursday, 9 June 2016 at 14:16:08 UTC, Jack Stouffer wrote:
>> Appender!string is a great example, as it's easy to add and it 
>> almost always results in measurable speed increases. You can 
>> see how one simple change using D features can make your 
>> program 5% faster.
>>
>> Every language has idiomatic uses to speed up your program, 
>> the real question is how much faster those make the code and 
>> how easy it is to implement those in your own code.
>
> I don't think you should benchmark library constructs like 
> Appender. That's essentially pointless.

Why? Maybe not John Doe's library, but certainly the standard 
library should be included in benchmarks as that is supposed to 
be highly reflective of the language...

> Benchmark the naked language. If D provides concatenation, 
> benchmark concatenation and how the optimizer turns them (or 
> don't) into something more efficient.

I don't even see how that's useful. It will help you make a 
better compiler. But not give to much information about the 
language. For instance if you benchmark a while loop in C, C++, 
Rust, and D all with LLVM backends...well the slower language 
really is just pointing towards some ineffectiveness of the 
compiler itself, as in a simple example, there really shouldn't 
be much difference. However, if you want to say "D has this 
feature which produces better performance than what those 
language can provide", that's a different story.

> Otherwise people would benchmark numpy instead of Python etc.




More information about the Digitalmars-d mailing list