On Sunday, 5 June 2016 at 21:58:46 UTC, Donald Drumpf wrote:
On Sunday, 5 June 2016 at 21:52:20 UTC, Ausprobierer wrote:
I've written this simple piece of code:

[CODE]
import std.algorithm;
import std.array;
import std.conv;
import std.datetime;
import std.parallelism;
import std.range;
import std.stdio;
import core.atomic;
import core.thread;

[...]

How many times did you run each? A single run isn't ever really useful. Also, not sure if this would account for the drastic difference, but declare long Z[] in global scope over in local scope might have some impact.

If I wrote this, it would be faster, I guarantee it.

With

[CODE]
import std.algorithm;
import std.array;
import std.conv;
import std.datetime;
import std.parallelism;
import std.range;
import std.stdio;
import core.atomic;
import core.thread;

long[] z = [1,1,2,2,3,3,4,4,5,5,6,6,0,0];

void main()
{
    immutable long n = 11;

    long l = z.length;
    long j = 0;
[...]
[/CODE]

and "dmd -m64 -O -inline -release <filename>.d" I still get 40 seconds runtime.

Reply via email to