mirror of
https://github.com/golang/go
synced 2024-11-19 05:54:44 -07:00
cmd/compile: add flag to disable DWARF generation
DWARF generation has non-trivial cost, and in some cases is not necessary. Provide an option to opt out. Alloc impact of disabling DWARF generation: name old alloc/op new alloc/op delta Template 38.7MB ± 0% 37.6MB ± 0% -2.77% (p=0.016 n=5+4) Unicode 29.8MB ± 0% 29.8MB ± 0% -0.16% (p=0.032 n=5+5) GoTypes 113MB ± 0% 110MB ± 0% -2.38% (p=0.008 n=5+5) Compiler 463MB ± 0% 457MB ± 0% -1.34% (p=0.008 n=5+5) SSA 1.25GB ± 0% 1.23GB ± 0% -1.64% (p=0.008 n=5+5) Flate 25.3MB ± 0% 25.0MB ± 0% -1.05% (p=0.008 n=5+5) GoParser 31.7MB ± 0% 30.9MB ± 0% -2.74% (p=0.008 n=5+5) Reflect 78.2MB ± 0% 76.7MB ± 0% -1.90% (p=0.008 n=5+5) Tar 26.5MB ± 0% 26.0MB ± 0% -2.04% (p=0.008 n=5+5) XML 42.4MB ± 0% 41.1MB ± 0% -2.86% (p=0.008 n=5+5) name old allocs/op new allocs/op delta Template 377k ± 0% 360k ± 1% -4.46% (p=0.008 n=5+5) Unicode 321k ± 0% 320k ± 0% ~ (p=0.151 n=5+5) GoTypes 1.14M ± 0% 1.10M ± 0% -4.13% (p=0.008 n=5+5) Compiler 4.26M ± 0% 4.13M ± 0% -3.14% (p=0.008 n=5+5) SSA 9.70M ± 0% 9.33M ± 0% -3.89% (p=0.008 n=5+5) Flate 233k ± 0% 228k ± 0% -2.40% (p=0.008 n=5+5) GoParser 316k ± 0% 302k ± 0% -4.48% (p=0.008 n=5+5) Reflect 980k ± 0% 945k ± 0% -3.62% (p=0.008 n=5+5) Tar 249k ± 0% 241k ± 0% -3.19% (p=0.008 n=5+5) XML 391k ± 0% 376k ± 0% -3.95% (p=0.008 n=5+5) Change-Id: I97dbfb6b40195d1e0b91be097a4bf0e7f65b26af Reviewed-on: https://go-review.googlesource.com/40857 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
89a355c930
commit
da67c23fbb
@ -201,6 +201,8 @@ var flag_race bool
|
||||
|
||||
var flag_msan bool
|
||||
|
||||
var flagDWARF bool
|
||||
|
||||
// Whether we are adding any sort of code instrumentation, such as
|
||||
// when the race detector is enabled.
|
||||
var instrumenting bool
|
||||
|
@ -118,7 +118,6 @@ func Main(archInit func(*Arch)) {
|
||||
archInit(&thearch)
|
||||
|
||||
Ctxt = obj.Linknew(thearch.LinkArch)
|
||||
Ctxt.DebugInfo = debuginfo
|
||||
Ctxt.DiagFunc = yyerror
|
||||
Ctxt.Bso = bufio.NewWriter(os.Stdout)
|
||||
|
||||
@ -181,6 +180,7 @@ func Main(archInit func(*Arch)) {
|
||||
flag.StringVar(&buildid, "buildid", "", "record `id` as the build id in the export metadata")
|
||||
flag.BoolVar(&pure_go, "complete", false, "compiling complete package (no C or assembly)")
|
||||
flag.StringVar(&debugstr, "d", "", "print debug information about items in `list`")
|
||||
flag.BoolVar(&flagDWARF, "dwarf", true, "generate DWARF symbols")
|
||||
obj.Flagcount("e", "no limit on number of errors reported", &Debug['e'])
|
||||
obj.Flagcount("f", "debug stack frames", &Debug['f'])
|
||||
obj.Flagcount("h", "halt on error", &Debug['h'])
|
||||
@ -227,6 +227,9 @@ func Main(archInit func(*Arch)) {
|
||||
|
||||
Ctxt.Debugasm = Debug_asm
|
||||
Ctxt.Debugvlog = Debug_vlog
|
||||
if flagDWARF {
|
||||
Ctxt.DebugInfo = debuginfo
|
||||
}
|
||||
|
||||
if flag.NArg() < 1 {
|
||||
usage()
|
||||
|
Loading…
Reference in New Issue
Block a user