codspeed-go

module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2025 License: Apache-2.0, MIT

README

codspeed-go

CI Discord CodSpeed Badge

This repo contains the integration libraries for using CodSpeed in Go:

Usage

Integrating CodSpeed into your Go codebase requires no modification. You can continue using go test and the testing package as you normally would. When running your benchmarks in CI with CodSpeed, we will manually build and run the benchmarks and report the results to CodSpeed.

For information on how to integrate it, see the CodSpeed documentation. If you need further information to integrate CodSpeed to your project, please feel free to open an issue or ask for help on our discord server.

Manual Usage

To run the benchmarks with CodSpeed locally, you need to install the go-runner crate which is used to build and execute the benchmarks with instrumentation:

$ cd go-runner
$ cargo install --path .

Then you can run the benchmarks with (the syntax is equivalent to go test but supports fewer flags). This will print all the benchmarks that can be run with CodSpeed and warnings if some benchmarks are not supported.

$ cd example
$ export CODSPEED_PROFILE_FOLDER=/tmp/codspeed
$ go-runner test -bench=.
[INFO  go_runner] Discovered 1 package
[INFO  go_runner] Total benchmarks discovered: 2
[INFO  go_runner] Found BenchmarkFibonacci10           in "fib_test.go"
[INFO  go_runner] Found BenchmarkFibonacci20_Loop      in "fib_test.go"
[INFO  go_runner] Generating custom runner for package: example
[INFO  go_runner] Running benchmarks for package: example
Running with CodSpeed (mode: walltime)
goos: linux
goarch: amd64
cpu: 12th Gen Intel(R) Core(TM) i7-1260P @ 1672.130MHz
BenchmarkFibonacci10/fibonacci(10)/fibonacci(10)-16                    1              1523 ns/op
BenchmarkFibonacci20_Loop-16                                           1             31373 ns/op
PASS
[INFO  go_runner] Parsed 2 raw results
[INFO  go_runner] Results written to "/tmp/codspeed/results/177951.json"

Directories

Path Synopsis
compat
testing/slogtest
https://pkg.go.dev/testing/slogtest
https://pkg.go.dev/testing/slogtest
pkg
quicktest
Package quicktest provides a collection of Go helpers for writing tests.
Package quicktest provides a collection of Go helpers for writing tests.
quicktest/qtsuite
Package qtsuite allows quicktest to run test suites.
Package qtsuite allows quicktest to run test suites.
slogassert
Package slogassert provides a slog Handler that allows testing that expected logging messages were made in your test code.
Package slogassert provides a slog Handler that allows testing that expected logging messages were made in your test code.
Package testing provides support for automated testing of Go packages.
Package testing provides support for automated testing of Go packages.
internal/bisect
Package bisect can be used by compilers and other programs to serve as a target for the bisect debugging tool.
Package bisect can be used by compilers and other programs to serve as a target for the bisect debugging tool.
internal/cfg
Package cfg holds configuration shared by the Go command and internal/testenv.
Package cfg holds configuration shared by the Go command and internal/testenv.
internal/cpu
Package cpu implements processor feature detection used by the Go standard library.
Package cpu implements processor feature detection used by the Go standard library.
internal/fuzz
Package fuzz provides common fuzzing functionality for tests built with "go test" and for programs that use fuzzing functionality in the testing package.
Package fuzz provides common fuzzing functionality for tests built with "go test" and for programs that use fuzzing functionality in the testing package.
internal/goarch
package goarch contains GOARCH-specific constants.
package goarch contains GOARCH-specific constants.
internal/godebug
Package godebug makes the settings in the $GODEBUG environment variable available to other packages.
Package godebug makes the settings in the $GODEBUG environment variable available to other packages.
internal/godebugs
Package godebugs provides a table of known GODEBUG settings, for use by a variety of other packages, including internal/godebug, runtime, runtime/metrics, and cmd/go/internal/load.
Package godebugs provides a table of known GODEBUG settings, for use by a variety of other packages, including internal/godebug, runtime, runtime/metrics, and cmd/go/internal/load.
internal/goexperiment
Package goexperiment implements support for toolchain experiments.
Package goexperiment implements support for toolchain experiments.
internal/goos
package goos contains GOOS-specific constants.
package goos contains GOOS-specific constants.
internal/race
Package race contains helper functions for manually instrumenting code for the race detector.
Package race contains helper functions for manually instrumenting code for the race detector.
internal/runtime/atomic
Package atomic provides atomic operations, independent of sync/atomic, to the runtime.
Package atomic provides atomic operations, independent of sync/atomic, to the runtime.
internal/runtime/sys
package sys contains system- and configuration- and architecture-specific constants used by the runtime.
package sys contains system- and configuration- and architecture-specific constants used by the runtime.
internal/synctest
Package synctest provides support for testing concurrent code.
Package synctest provides support for testing concurrent code.
internal/syscall/windows/registry
Package registry provides access to the Windows registry.
Package registry provides access to the Windows registry.
internal/syscall/windows/sysdll
Package sysdll is an internal leaf package that records and reports which Windows DLL names are used by Go itself.
Package sysdll is an internal leaf package that records and reports which Windows DLL names are used by Go itself.
internal/sysinfo
Package sysinfo implements high level hardware information gathering that can be used for debugging or information purposes.
Package sysinfo implements high level hardware information gathering that can be used for debugging or information purposes.
internal/testenv
Package testenv provides information about what functionality is available in different testing environments run by the Go team.
Package testenv provides information about what functionality is available in different testing environments run by the Go team.
internal/testlog
Package testlog provides a back-channel communication path between tests and package os, so that cmd/go can see which environment variables and files a test consults.
Package testlog provides a back-channel communication path between tests and package os, so that cmd/go can see which environment variables and files a test consults.
internal/txtar
Package txtar implements a trivial text-based file archive format.
Package txtar implements a trivial text-based file archive format.
testing/fstest
Package fstest implements support for testing implementations and users of file systems.
Package fstest implements support for testing implementations and users of file systems.
testing/internal/testdeps
Package testdeps provides access to dependencies needed by test execution.
Package testdeps provides access to dependencies needed by test execution.
testing/iotest
Package iotest implements Readers and Writers useful mainly for testing.
Package iotest implements Readers and Writers useful mainly for testing.
testing/quick
Package quick implements utility functions to help with black box testing.
Package quick implements utility functions to help with black box testing.
testing/slogtest
Package slogtest implements support for testing implementations of log/slog.Handler.
Package slogtest implements support for testing implementations of log/slog.Handler.

Jump to

Keyboard shortcuts

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