# code-block-pro/1.7.0/build/shiki/samples/d.sample

Code Block Pro – Beautiful Syntax Highlighting, version 1.7.0. 18 lines.

- Page: https://pluginprobe.com/plugins/code-block-pro/1.7.0/code/build/shiki/samples/d.sample
- Raw: https://pluginprobe.com/plugins/code-block-pro/1.7.0/raw/build/shiki/samples/d.sample
- Modified: 2022-08-22T22:25:46+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/code-block-pro/1.7.0/code/build/shiki/samples/d.sample#L10-L20`.

```
void main()
{
    import std.datetime.stopwatch : benchmark;
    import std.math, std.parallelism, std.stdio;

    auto logs = new double[100_000];
    auto bm = benchmark!({
        foreach (i, ref elem; logs)
            elem = log(1.0 + i);
    }, {
        foreach (i, ref elem; logs.parallel)
            elem = log(1.0 + i);
    })(100); // number of executions of each tested function
    writefln("Linear init: %s msecs", bm[0].total!"msecs");
    writefln("Parallel init: %s msecs", bm[1].total!"msecs");
}

// From https://dlang.org/
```
