Benchinit Save Abandoned

Benchmark the init cost of Go packages

Project README

benchinit

Deprecated: use GODEBUG=inittrace=1 on Go 1.16 or later: https://golang.org/doc/go1.16#runtime

Benchmark the initialization cost of your packages or programs.

cd $(mktemp -d); go mod init tmp; go get mvdan.cc/benchinit

This includes the cost of init functions, plus initialising globals. In other words, a package's contribution to the slowness before main is run.

Requires Go 1.12 or later.

Quickstart

Benchmarking a single package is simple:

benchinit cmd/go

You can also include all dependencies in the benchmark:

benchinit -r cmd/go

Finally, like any other benchmark, you can pass in go test flags:

benchinit -r -count=5 -benchtime=2s cmd/go

Further reading

This tool was result of a discussion with @josharian. You can read more about Josh's idea in his blog post.

Open Source Agenda is not affiliated with "Benchinit" Project. README Source: mvdan/benchinit
Stars
64
Open Issues
0
Last Commit
3 years ago
License

Open Source Agenda Badge

Open Source Agenda Rating