Create benchmarks for your Go codebase using the testing
package
go test
CLI flags are supported.
See the compatibility section for more information on how to ensure your benchmarks work with CodSpeed.If you have any feedback, please reach out to us via
Discord or
email our support.go test
and the testing
package as you normally would. When running your benchmarks in CI with CodSpeed, your benchmarks will automatically be built and the reports will be sent to CodSpeed.
testing
package to write benchmarks in Go. If the benchmarks are working with go test
, then they will also automatically be detected by CodSpeed without any additional configuration.
Here’s an example of a simple Fibonacci function benchmark:
b.Loop()
as it’s more precise and efficienttestify
or quicktest
because they depend on testing
which we are overriding.If you only use these packages in your tests, we recommend to split your benchmarks into separate files that do not import these packages. This will allow our runner to pickup and build the benchmarks correctly.We’re planning to support this use case in the future, so let us know if you need this feature.codspeed
runner:
go test
command with CodSpeed:
main
branch and every
pull request:
go test
command to only run a subset of benchmarks in each job.
go test
:
-bench
(required)