On Sunday, 17 May 2020 at 03:30:57 UTC, Adnan wrote:
In my machine, if you feed "aa" and "bbc" to the function, ldc generated code takes around 400 microseconds. I don't have an access to gdc in my machine.

https://imgshare.io/image/NN8Xmp

Full code:
    D : https://run.dlang.io/is/vLj7BC
  Nim : https://play.nim-lang.org/#ix=2mhH (for reference)

Compiler flags:
    dub : build -b release-nobounds
 nimble : --d:danger

My timings are very different, using LDC v1.21 on Win64:

* ldc2 -O -release -run bla.d aa bbc: 8-9 μs
* ldc2 -O -release -boundscheck=off -run bla.d aa bbc: 8-9 μs
* ldc2 -O -release -boundscheck=off -flto=full -defaultlib=phobos2-ldc-lto,druntime-ldc-lto -run bla.d aa bbc: 4 μs

DMD v2.091:
* dmd -m64 -O -release -boundscheck=off -run ..\speed.d aa bbc: ~11 μs

As a side note, using jagged arrays for multiple dimensions should probably be avoided whenever you can.

Reply via email to