On Friday, 17 June 2016 at 16:51:04 UTC, Jack Stouffer wrote:
On Wednesday, 8 June 2016 at 22:19:47 UTC, Bauss wrote:
D definitely needs some optimizations, I mean look at its benchmarks compared to other languages: https://github.com/kostya/benchmarks

Welp, I tried making it faster and I apparently made it slower: https://github.com/kostya/benchmarks/pull/89

Oops.

Fixed: https://github.com/kostya/benchmarks/pull/91

This should be enough to make D the fastest in bench.b and second/third after C++ Gcc / Crystal, without changing the algorithm, which is not allowed.

Request to future contributors: please benchmark the code and make sure there's an improvement in the majority of compilers and most importantly in the fastest case (LDC in this instance) before submitting changes. Code style / refactoring changes are clearly welcome, as long as they don't decrease the performance.

In this particular case `@safe` is a performance pessimization in release mode, because it introduces bounds checks. To remedy that, one has to compile with `-boundscheck=off`. See https://dlang.org/dmd-linux.html#switch-boundscheck for more info.

A note about my changes: as for this piece of code we are only interested in performance and code brevity, I decided to omit attributes as no combination of them could bring performance improvement (and @safe was a pessimization in all of my tests, given the build flags). I have more information about the changes in the pull request.

Overall DMD completes mandel.b for 75.5% of the time of the previous version, LDC for 62.6% and GDC for 88.1%. The code is 64.9% of the original (in terms of LOC).

Reply via email to