Go vs. D [was Re: Rust vs Dlang]

Walter Bright newshound2 at digitalmars.com
Mon Mar 25 19:43:00 PDT 2013


On 3/25/2013 5:02 AM, Rory McGuire wrote:
> The profiling doc is here: http://blog.golang.org/2011/06/profiling-go-programs.html
> It is all super easy, and documented so that you can do it now.

What it says about profiling:

"To start tuning the Go program, we have to enable profiling. If the code used 
the Go testing package's benchmarking support, we could use gotest's standard 
-cpuprofile and -memprofile flags. In a standalone program like this one, we 
have to import runtime/pprof and add a few lines of code:"
[... bunch of code you have to copy/pasta in ...]
"After adding that code, we can run the program with the new -cpuprofile flag 
and then run gopprof to interpret the profile."


How to do profiling with the dmd D compiler:

1. Add the -profile switch to the command line.

2. Read the report generated.

To do coverage analysis:

1. Add the -cov switch to the command line.

2. Read the report generated.

That's it.



More information about the Digitalmars-d-announce mailing list