performance - Measuring execution time in the D language -


i'm new d language , need measure execution time of algorithm. options? there built-in solution? not find conclusive on web.

one way use -profile command line parameter. after run program, create file trace.log can find run time each function. of course slow down program compiler insert time counting code each function. method used find relative speed of functions, identify should optimize improve app speed minimum effort.

second options use std.datetime.stopwatch class. see example in link.

or better suited might directly use std.datetime.benchmark function.

don't forget:

  1. when benchmarking use these dmd compiler flags achieve maximum optimization -release -o -inline -noboundscheck.
  2. never benchmark debug builds.
  3. make sure don't call library code inside benchmarked functions - benchmarking performance of library implementation instead of own code.

additionally may consider using ldc or gdc compilers. both of them provide better optimizations / app run speed dmd.


Comments

Popular posts from this blog

How to logout from a login page in asp.net -

Stack level too deep error after upgrade to rails 3.2 and ruby 1.9.3 -