Function to print a diamond shape

Jay Norwood jayn at prismnet.com
Sat Mar 22 18:03:45 PDT 2014


I decided to redirect stdout to nul and print the stopwatch 
messages to stderr.
So, basically like this.

import std.stdio;
import std.datetime;
import std.cstream;

StopWatch sw;
sw.start();

measured code

sw.stop();
derr.writefln("time: ", sw.peek().msecs, "[ms]");

Then, windows results comparing two versions, this for n=2001, 
shows one form is about 3x faster when you redirect stdout to nul.

D:\diamond\diamond\diamond\Release>diamond 1>nul
time: 15[ms]
time: 42[ms]








More information about the Digitalmars-d-learn mailing list