Commenting out a print slows my code?
Jesse Phillips
jessekphillips+D at gmail.com
Wed Mar 9 18:04:01 PST 2011
Charles McAnany Wrote:
> (There's also a StopWatch timing things, and isTaxiNumber returns a struct,
> not a bool. See attached code.)
> This code runs in about 0.09 seconds.
> If I comment out the writefln, it takes 0.11 seconds.
> (These are collected from about 20 runs of each. Times are very consistent.)
> Any ideas why commenting out the write makes things slower?
> Cheers,
> Charles.
I couldn't get the code to compile with the stop watch. So instead I removed that and used time. In this case I get user times between .150 and .200 approximately. Maybe with the print statement your program is given higher priority than without, that would mean the operating system would let your application run longer or more frequently than other programs (don't remember if one or both of those is changed).
More information about the Digitalmars-d-learn
mailing list