Skip to content

Instantly share code, notes, and snippets.

@imiric
Last active June 23, 2023 14:48
Show Gist options
  • Save imiric/b2094c79f45cbdbdcb067671434fde4a to your computer and use it in GitHub Desktop.
Save imiric/b2094c79f45cbdbdcb067671434fde4a to your computer and use it in GitHub Desktop.
k6 event system benchmarks

Benchmark results for grafana/k6#3112 comparing the run of a simple script on master (97d40e939) and feat/2432-events (d5897faac), with and without importing a JS module that uses events.

Commands ran:

$ go test -bench='^BenchmarkRun$' -run='^$' -benchtime=100x -count=10 -benchmem ./cmd/tests \
  | tee "bench_run_$(git rev-parse --short HEAD).txt"

$ go test -bench='^BenchmarkRunEvents$' -run='^$' -benchtime=100x -count=10 -benchmem ./cmd/tests \
  | tee "bench_run_events_$(git rev-parse --short HEAD).txt"

$ benchstat bench_run_97d40e939_master.txt bench_run_d5897faac.txt > bench_run_stat.txt
$ benchstat bench_run_events_d5897faac.txt > bench_run_events_stat.txt
goos: linux
goarch: amd64
pkg: go.k6.io/k6/cmd/tests
cpu: Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
BenchmarkRun-12 100 16988463 ns/op 6029312 B/op 82222 allocs/op
BenchmarkRun-12 100 17126941 ns/op 6005366 B/op 81940 allocs/op
BenchmarkRun-12 100 17562447 ns/op 6004597 B/op 81939 allocs/op
BenchmarkRun-12 100 17239834 ns/op 6007842 B/op 81942 allocs/op
BenchmarkRun-12 100 17162795 ns/op 6005728 B/op 81934 allocs/op
BenchmarkRun-12 100 17871380 ns/op 6004937 B/op 81930 allocs/op
BenchmarkRun-12 100 17342377 ns/op 6004726 B/op 81931 allocs/op
BenchmarkRun-12 100 17293196 ns/op 6004862 B/op 81944 allocs/op
BenchmarkRun-12 100 17504446 ns/op 6006827 B/op 81941 allocs/op
BenchmarkRun-12 100 17542719 ns/op 6004401 B/op 81936 allocs/op
PASS
ok go.k6.io/k6/cmd/tests 18.227s
goos: linux
goarch: amd64
pkg: go.k6.io/k6/cmd/tests
cpu: Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
BenchmarkRun-12 100 16938287 ns/op 6074208 B/op 83260 allocs/op
BenchmarkRun-12 100 17151561 ns/op 6052359 B/op 83017 allocs/op
BenchmarkRun-12 100 17337815 ns/op 6052640 B/op 83020 allocs/op
BenchmarkRun-12 100 17396995 ns/op 6051802 B/op 83023 allocs/op
BenchmarkRun-12 100 17404456 ns/op 6053758 B/op 83011 allocs/op
BenchmarkRun-12 100 17340936 ns/op 6051560 B/op 83024 allocs/op
BenchmarkRun-12 100 17534087 ns/op 6052194 B/op 83017 allocs/op
BenchmarkRun-12 100 17209798 ns/op 6049114 B/op 83012 allocs/op
BenchmarkRun-12 100 17357624 ns/op 6050651 B/op 83012 allocs/op
BenchmarkRun-12 100 17172238 ns/op 6056144 B/op 83021 allocs/op
PASS
ok go.k6.io/k6/cmd/tests 18.107s
goos: linux
goarch: amd64
pkg: go.k6.io/k6/cmd/tests
cpu: Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
BenchmarkRunEvents-12 100 28554499 ns/op 8588335 B/op 119213 allocs/op
BenchmarkRunEvents-12 100 28707434 ns/op 8578555 B/op 118984 allocs/op
BenchmarkRunEvents-12 100 29223422 ns/op 8606980 B/op 118990 allocs/op
BenchmarkRunEvents-12 100 29093050 ns/op 8604878 B/op 118998 allocs/op
BenchmarkRunEvents-12 100 29161863 ns/op 8657927 B/op 119009 allocs/op
BenchmarkRunEvents-12 100 29123234 ns/op 8657595 B/op 118997 allocs/op
BenchmarkRunEvents-12 100 29145927 ns/op 8659030 B/op 118995 allocs/op
BenchmarkRunEvents-12 100 29704939 ns/op 8659709 B/op 119005 allocs/op
BenchmarkRunEvents-12 100 28887705 ns/op 8758983 B/op 119003 allocs/op
BenchmarkRunEvents-12 100 29309489 ns/op 8769339 B/op 119002 allocs/op
PASS
ok go.k6.io/k6/cmd/tests 30.101s
goos: linux
goarch: amd64
pkg: go.k6.io/k6/cmd/tests
cpu: Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
│ bench_run_events_d5897faac.txt │
│ sec/op │
RunEvents-12 29.13m ± 1%
│ bench_run_events_d5897faac.txt │
│ B/op │
RunEvents-12 8.257Mi ± 1%
│ bench_run_events_d5897faac.txt │
│ allocs/op │
RunEvents-12 119.0k ± 0%
goos: linux
goarch: amd64
pkg: go.k6.io/k6/cmd/tests
cpu: Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
│ bench_run_97d40e939_master.txt │ bench_run_d5897faac.txt │
│ sec/op │ sec/op vs base │
Run-12 17.32m ± 1% 17.34m ± 1% ~ (p=0.631 n=10)
│ bench_run_97d40e939_master.txt │ bench_run_d5897faac.txt │
│ B/op │ B/op vs base │
Run-12 5.727Mi ± 0% 5.772Mi ± 0% +0.78% (p=0.000 n=10)
│ bench_run_97d40e939_master.txt │ bench_run_d5897faac.txt │
│ allocs/op │ allocs/op vs base │
Run-12 81.94k ± 0% 83.02k ± 0% +1.32% (p=0.000 n=10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment