June 2018 Update
This commit is contained in:
parent
ba8067c3b7
commit
22f33d4004
5278 changed files with 84726 additions and 14379 deletions
20
Task/Rate-counter/D/rate-counter.d
Normal file
20
Task/Rate-counter/D/rate-counter.d
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import std.stdio;
|
||||
import std.conv;
|
||||
import std.datetime.stopwatch;
|
||||
|
||||
int a;
|
||||
void f0() {}
|
||||
void f1() { auto b = a; }
|
||||
void f2() { auto b = to!string(a); }
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
auto r = benchmark!(f0, f1, f2)(10_000);
|
||||
|
||||
writeln("Time fx took to run 10,000 times:\n");
|
||||
writeln("f0: ", r[0]);
|
||||
writeln("f1: ", r[1]);
|
||||
writeln("f2: ", r[2]);
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue