On Saturday, 2 September 2017 at 15:41:54 UTC, Joakim wrote:
On Saturday, 2 September 2017 at 14:49:30 UTC, thinwybk wrote:
On Friday, 14 July 2017 at 13:29:30 UTC, Joakim wrote:
Yes, D's compile-time regex are still the fastest in the world. I've been benching it recently for a marketing-oriented blog post I'm preparing for the official D blog, std.regex beats out the top C and Rust entries from the benchmarks game on linux/x64 with a single core:

http://benchmarksgame.alioth.debian.org/u64q/regexredux.html
https://github.com/joakim-noah/regex-bench

D comes in third on Android/ARM, but not far behind, suggesting it would still be third on that list if run with a bunch of other languages on mobile. Dmitry thinks it might be alignment issues, the bane of cross-platform, high-performance code on ARM, as he hasn't optimized his regex code for ARM.

Do you plan to implement a version for the fastest benchmark "n-body" (http://benchmarksgame.alioth.debian.org/u64q/nbody.html) as well?

No, the goal is to demonstrate the nice, super-speedy regex engine in the D standard library by using that same benchmark that Dmitry exhibited years ago, to show D still does really well at regex. It's not to try and compete across all those benchmarks, which D used to dominate at one time.

I did wonder how D does on that n-body benchmark now, so I built and ran the fastest C++ version, #8, on my single-core linux/x64 VPS. Here's the source link for each benchmark, the compiler version, and the command I used to build it:

C++:
http://benchmarksgame.alioth.debian.org/u64q/program.php?test=nbody&lang=gpp&id=8

clang/llvm 4.0.1

clang -O3 -std=c++11 nbody.cpp -lm -onbody-cpp

D:
https://bitbucket.org/qznc/d-shootout/raw/898f7f3b3c5d55680229113e973ef95ece6f711a/progs/nbody/nbody.d

ldc 1.4 beta1, llvm 4.0.1

ldc2 -O3 nbody.d

The D version averages 2.5 seconds, the C++ version 6 seconds, which means D would likely still be at the top of that n-body ranking today.

Sorry, I assumed the D version worked fine and didn't bother to check the output, turns out it needs two foreach loops changed in advance(dt). Specifically, "Body i" should be changed to "ref Body i" in both foreach statements, so the data is actually updated. ;)

After that change, the C++ version wins by a little, 6 seconds vs. 6.5 seconds for the D translation. I see that the C++ version directly invokes SIMD intrinsics, so perhaps that's to be expected.

Reply via email to