Optimizations and performance

Jack Stouffer via Digitalmars-d digitalmars-d at puremagic.com
Thu Jun 9 07:16:08 PDT 2016


On Thursday, 9 June 2016 at 13:32:14 UTC, Dave wrote:
> I think you can trust benchmark. I think the bigger key is 
> understanding what you are truly benchmarking.

I agree with your general point, but what I find most useful 
about benchmarks is the ability to find the lower bound of 
performance without resorting to inline asm or making the program 
ugly as sin.

If you can find, "In this particular task, D has these tricks it 
can use to make it really fast", I think that's useful as many 
other languages won't have those options. You can see how much 
you as a programmer can optimize the hot points in your code and 
how easy that is to do just by looking at the benchmarked code.

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.


More information about the Digitalmars-d mailing list