speed up builds with the compiler's -dwarf=false flag

Generating DWARF in the compiler object files could take as much as 10%
extra CPU time, while we ignore it entirely at the link stage.

Speeds up 'go test -short' from ~19.5s to ~18.5s on my laptop.
pull/49/head
Daniel Martí 4 years ago
parent ccd46404c0
commit 442eb4e139

@ -465,6 +465,10 @@ func transformCompile(args []string) ([]string, error) {
args = append(args, tempFile.Name())
}
// We will force the linker to drop DWARF via -w, so don't spend time
// generating it.
flags = append(flags, "-dwarf=false")
return args, nil
}
@ -876,6 +880,7 @@ func transformLink(args []string) ([]string, error) {
flags = append(flags, "-X", "runtime/internal/sys.TheVersion=unknown")
flags = append(flags, "-X", "runtime.buildVersion=unknown")
// Strip debug information and symbol tables.
flags = append(flags, "-w", "-s")
return append(flags, paths...), nil
}

Loading…
Cancel
Save