Skip to content

Commit f7f1704

Browse files
committed
wip: squash go-runner
1 parent 67724e3 commit f7f1704

File tree

48 files changed

+4173
-6
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+4173
-6
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
go-runner/testdata/raw_results/*.json filter=lfs diff=lfs merge=lfs -text

.github/workflows/ci.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: CI
2+
on:
3+
push:
4+
branches: [main]
5+
pull_request:
6+
workflow_dispatch:
7+
8+
jobs:
9+
lint:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
with:
14+
submodules: true
15+
- uses: actions/setup-go@v5
16+
- uses: moonrepo/setup-rust@v1
17+
with:
18+
components: rustfmt, clippy
19+
- uses: pre-commit/[email protected]
20+
with:
21+
extra_args: --all-files
22+
23+
tests:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- uses: actions/checkout@v4
27+
with:
28+
submodules: true
29+
- uses: moonrepo/setup-rust@v1
30+
- run: |
31+
cd go-runner
32+
cargo test --all
33+
34+
35+
compat-integration-test-walltime:
36+
runs-on: codspeed-macro
37+
steps:
38+
- uses: actions/checkout@v4
39+
with:
40+
submodules: true
41+
- uses: actions/setup-go@v5
42+
- uses: moonrepo/setup-rust@v1
43+
with:
44+
cache-target: release
45+
46+
- name: Build the golang benchmarks
47+
run: |
48+
cd go-runner
49+
cargo r -- build ../example
50+
51+
- name: Run the benchmarks
52+
uses: CodSpeedHQ/action@main
53+
with:
54+
run: |
55+
cd go-runner
56+
cargo r -- run
57+
58+
check:
59+
runs-on: ubuntu-latest
60+
if: always()
61+
needs:
62+
- lint
63+
- tests
64+
- compat-integration-test-walltime
65+
steps:
66+
- uses: re-actors/alls-green@release/v1
67+
with:
68+
jobs: ${{ toJson( needs ) }}

.gitmodules

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[submodule "go-runner/testdata/projects/caddy"]
2+
path = go-runner/testdata/projects/caddy
3+
url = https://github.com/caddyserver/caddy.git
4+
[submodule "go-runner/testdata/projects/fzf"]
5+
path = go-runner/testdata/projects/fzf
6+
url = https://github.com/junegunn/fzf.git
7+
[submodule "go-runner/testdata/projects/opentelemetry-go"]
8+
path = go-runner/testdata/projects/opentelemetry-go
9+
url = https://github.com/open-telemetry/opentelemetry-go.git
10+
[submodule "go-runner/testdata/projects/golang-benchmarks"]
11+
path = go-runner/testdata/projects/golang-benchmarks
12+
url = https://github.com/SimonWaldherr/golang-benchmarks.git

.pre-commit-config.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,33 @@ repos:
66
- id: end-of-file-fixer
77
- id: check-yaml
88
- id: check-json
9+
exclude: ^go-runner/testdata/
910
- id: check-merge-conflict
1011
- id: check-added-large-files
12+
13+
- repo: https://github.com/doublify/pre-commit-rust
14+
rev: v1.0
15+
hooks:
16+
- id: fmt
17+
args: [--all, --]
18+
files: ^go-runner/
19+
pass_filenames: false
20+
additional_dependencies: []
21+
entry: bash -c 'cd go-runner && cargo fmt --all'
22+
language: system
23+
24+
- id: cargo-check
25+
args: [--all-targets]
26+
files: ^go-runner/
27+
pass_filenames: false
28+
additional_dependencies: []
29+
entry: bash -c 'cd go-runner && cargo check --all-targets'
30+
language: system
31+
32+
- id: clippy
33+
args: [--all-targets, --, -D, warnings]
34+
files: ^go-runner/
35+
pass_filenames: false
36+
additional_dependencies: []
37+
entry: bash -c 'cd go-runner && cargo clippy --all-targets -- -D warnings'
38+
language: system

example/fib_test.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package example
22

3-
import testing "github.com/AvalancheHQ/codspeed-go/compat/testing"
3+
import "testing"
44

55
func BenchmarkFibonacci10(b *testing.B) {
66
for i := 0; i < b.N; i++ {
@@ -14,12 +14,18 @@ func BenchmarkFibonacci10(b *testing.B) {
1414
})
1515
}
1616

17-
func BenchmarkFibonacci20(b *testing.B) {
17+
func BenchmarkFibonacci20_Loop(b *testing.B) {
1818
for b.Loop() {
1919
fibonacci(20)
2020
}
2121
}
2222

23+
func BenchmarkFibonacci20_bN(b *testing.B) {
24+
for i := 0; i < b.N; i++ {
25+
fibonacci(20)
26+
}
27+
}
28+
2329
func BenchmarkFibonacci30(b *testing.B) {
2430
for i := 0; i < b.N; i++ {
2531
fibonacci(30)

example/go.mod

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
11
module example
22

33
go 1.24.3
4-
5-
require github.com/AvalancheHQ/codspeed-go v0.0.0
6-
7-
replace github.com/AvalancheHQ/codspeed-go => ..

example/sleep_test.go

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
package example
2+
3+
import (
4+
"testing"
5+
"time"
6+
)
7+
8+
func busyWait(duration time.Duration) {
9+
start := time.Now()
10+
for time.Since(start) < duration {
11+
// Busy wait loop
12+
}
13+
}
14+
15+
func BenchmarkSleep100ns(b *testing.B) {
16+
for i := 0; i < b.N; i++ {
17+
busyWait(100 * time.Nanosecond)
18+
}
19+
}
20+
21+
func BenchmarkSleep1us(b *testing.B) {
22+
for i := 0; i < b.N; i++ {
23+
busyWait(1 * time.Microsecond)
24+
}
25+
}
26+
27+
func BenchmarkSleep10us(b *testing.B) {
28+
for i := 0; i < b.N; i++ {
29+
busyWait(10 * time.Microsecond)
30+
}
31+
}
32+
33+
func BenchmarkSleep100us(b *testing.B) {
34+
for i := 0; i < b.N; i++ {
35+
busyWait(100 * time.Microsecond)
36+
}
37+
}
38+
39+
func BenchmarkSleep1ms(b *testing.B) {
40+
for i := 0; i < b.N; i++ {
41+
busyWait(1 * time.Millisecond)
42+
}
43+
}
44+
45+
func BenchmarkSleep10ms(b *testing.B) {
46+
for i := 0; i < b.N; i++ {
47+
busyWait(10 * time.Millisecond)
48+
}
49+
}
50+
51+
func BenchmarkSleep50ms(b *testing.B) {
52+
for i := 0; i < b.N; i++ {
53+
busyWait(50 * time.Millisecond)
54+
}
55+
}

go-runner/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
build-*/
2+
target/
3+
.codspeed

0 commit comments

Comments
 (0)