compilebench

command
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2021 License: 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.

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

-linkflags 'list'
	Pass the space-separated list of flags to the linker.

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

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

-go path
	Path to "go" command (default "go").

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

-memprofilerate rate
	Set runtime.MemProfileRate during compilation.

-obj
	Report object file statistics.

-pkg pkg
	Benchmark compiling a single package.

-run regexp
	Only run benchmarks with names matching regexp.

-short
	Skip long-running benchmarks.

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