compilebench

command
v0.0.0-...-52d6a69 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 19, 2019 License: Apache-2.0, BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Overview

Compilebench benchmarks the speed of the Go compiler.

Usage:

compilebench [options]

It times the compilation of various packages and prints results in the format used by package testing (and expected by golang.org/x/perf/cmd/benchstat).

The options are:

	-alloc
		Report allocations.

	-compile exe
		Use exe as the path to the cmd/compile binary.

	-compileflags 'list'
		Pass the space-separated list of flags to the compilation.

	-count n
		Run each benchmark n times (default 1).

	-cpuprofile file
		Write a CPU profile of the compiler to file.

	-memprofile file
		Write a memory profile of the compiler to file.

	-memprofilerate rate
		Set runtime.MemProfileRate during compilation.

	-obj
		Report object file statistics.

 -pkg
		Benchmark compiling a single package.

	-run regexp
		Only run benchmarks with names matching regexp.

Although -cpuprofile and -memprofile are intended to write a combined profile for all the executed benchmarks to file, today they write only the profile for the last benchmark executed.

The default memory profiling rate is one profile sample per 512 kB allocated (see “go doc runtime.MemProfileRate”). Lowering the rate (for example, -memprofilerate 64000) produces a more fine-grained and therefore accurate profile, but it also incurs execution cost. For benchmark comparisons, never use timings obtained with a low -memprofilerate option.

Example

Assuming the base version of the compiler has been saved with “toolstash save,” this sequence compares the old and new compiler:

compilebench -count 10 -compile $(toolstash -n compile) >old.txt
compilebench -count 10 >new.txt
benchstat old.txt new.txt

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL