www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - D performance in Julia microbenchmarks

reply Carl Vogel <carljv gmail.com> writes:
Hi -- first-time poster, long-time lurker...

On its homepage, the Julia langauge (http://julialang.org) 
advertises some microbenchmark results to show how competitive it 
is with C, along with a number of other languages (go, python, 
JS, R, etc.). These should of course be taken with a big grain of 
salt, for the usual reasons (the implementations differ across 
languages, even at the algorithmic level, whether these are 
representative of real-life perf, not really rigorously timed, 
etc.)

I implemented these in D and found it did really well across all 
of them (no great surprise,  but good to see). The results are at 
the bottom, in absolute time and time relative to C. (note the 
infinite relative times are b/c the cc -O3 basically optimized 
the computation away)

The github code is here:  https://github.com/carljv/julia-perf

I think it'd be good advertising to make a PR with these to the 
Julia repo and see if they'll put them on the site. A lot of 
people we drawn to Julia because it was making promises similar 
to D -- C-like performance in an easy-to-use language  (in 
Julia's case, dynamic) with good metaprogramming (in Julia's 
case, AST macros).

But I'd be thrilled if anyone---esp. those with D 
science/numerics knowledge---would be willing to take a look. 
E.g., I'm rolling my own matrix operations wrapping blas 
functions because I couldn't easily find the functionality in 
scid, mir, etc., but feel like I'm missing something. And I think 
while showing easy C ffi is great, showing that you can do this 
easily with a library would be good too.

I'm also a bit of a D novice, so may be leaving some performance 
on the table. (Note though that I am trying to keep the code 
roughly inline with the Julia implementation and not using, like 
ASM or uglier perf hacks. It'd be nice to show off how D gives 
you high-level constructs with speed, not just writing the C 
implementation in D.)

If you want to replicate these, the README on the repo should be 
relatively complete/correct about setting up and running.

Please let me know if you're interested in this and have any 
questions or issues.

FIB:
   dlang/ldc2	  0.01ms	  infx
             go	  0.05ms	  infx
           julia	  0.06ms	  infx
      python	  3.56ms	  infx

MANDEL:
   dlang/ldc2	  0.13ms	 1.22x
             go	  0.19ms	 1.84x
           julia	  0.20ms	 1.88x
       python	  3.97ms	38.19x

PARSE_INT:
              go	  0.15ms	 1.06x
           julia	  0.18ms	 1.23x
   dlang/ldc2	  0.18ms	 1.25x
      python	  2.68ms	18.75x

PI_SUM:
   dlang/ldc2	  2.91ms	0.40x
           julia	  7.27ms	0.99x
             go	  8.40ms	1.14x
      python	819.50ms	111.10x

QUICKSORT:
   dlang/ldc2	  0.21ms	 0.55x
           julia	  0.37ms	 0.96x
             go	  0.48ms	 1.25x
      python	 14.53ms	37.73x

RAND_MAT_MUL:
   dlang/ldc2	 29.65ms	 0.71x
           julia	 49.88ms	 1.19x
             go	 68.84ms	 1.65x
       python	 71.95ms	 1.72x

RAND_MAT_STAT:
   dlang/ldc2	  8.11ms	1.26x
         julia	 21.99ms	3.40x
            go	 22.00ms	3.40x
      python	118.10ms	18.27x
May 18 2016
parent jmh530 <john.michael.hall gmail.com> writes:
On Wednesday, 18 May 2016 at 19:00:06 UTC, Carl Vogel wrote:
 Please let me know if you're interested in this and have any 
 questions or issues.
Cool.
May 18 2016