Skip to content

Commit db00ce3

Browse files
committed
feat(docs): add readme
1 parent 15a7f9a commit db00ce3

File tree

1 file changed

+50
-1
lines changed

1 file changed

+50
-1
lines changed

README.md

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,50 @@
1-
# codspeed-go
1+
<div align="center">
2+
<h1>codspeed-go</h1>
3+
4+
[![CI](https://github.com/CodSpeedHQ/codspeed-go/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/CodSpeedHQ/codspeed-go/actions/workflows/ci.yml)
5+
[![Discord](https://img.shields.io/badge/chat%20on-discord-7289da.svg)](https://discord.com/invite/MxpaCfKSqF)
6+
[![CodSpeed Badge](https://img.shields.io/endpoint?url=https://codspeed.io/badge.json)](https://codspeed.io/CodSpeedHQ/codspeed-go)
7+
8+
</div>
9+
10+
This repo contains the integration libraries for using CodSpeed in Go:
11+
12+
- [`go-runner`](./go-runner/): Golang benchmark builder and runner
13+
- [`compat/testing`](./compat/testing/): Compatibility layer for the `testing` package.
14+
15+
## Usage
16+
17+
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.
18+
19+
For information on how to integrate it, see the [CodSpeed documentation](https://codspeed.io/docs/benchmarks/golang). 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.
20+
21+
22+
## Manual Usage
23+
24+
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:
25+
```bash
26+
$ cd go-runner
27+
$ cargo install --path .
28+
```
29+
30+
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.
31+
```bash
32+
$ cd example
33+
$ export CODSPEED_PROFILE_FOLDER=/tmp/codspeed
34+
$ go-runner test -bench=.
35+
[INFO go_runner] Discovered 1 package
36+
[INFO go_runner] Total benchmarks discovered: 2
37+
[INFO go_runner] Found BenchmarkFibonacci10 in "fib_test.go"
38+
[INFO go_runner] Found BenchmarkFibonacci20_Loop in "fib_test.go"
39+
[INFO go_runner] Generating custom runner for package: example
40+
[INFO go_runner] Running benchmarks for package: example
41+
Running with CodSpeed instrumentation
42+
goos: linux
43+
goarch: amd64
44+
cpu: 12th Gen Intel(R) Core(TM) i7-1260P @ 1672.130MHz
45+
BenchmarkFibonacci10/fibonacci(10)/fibonacci(10)-16 1 1523 ns/op
46+
BenchmarkFibonacci20_Loop-16 1 31373 ns/op
47+
PASS
48+
[INFO go_runner] Parsed 2 raw results
49+
[INFO go_runner] Results written to "/tmp/codspeed/results/177951.json"
50+
```

0 commit comments

Comments
 (0)