Skip to content

Commit

Permalink
tools: Add short benchmark runner option (#263)
Browse files Browse the repository at this point in the history
* Added short option for benchmarks

* Added benchmark short command to top-level Makefile aswell
  • Loading branch information
jsimnz committed Mar 3, 2022
1 parent 4871b9f commit 8dd342f
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ test\:clean: clean\:test test
test\:bench:
make -C ./bench/ bench

.PHONY: test\:bench-short
test\:bench-short:
make -C ./bench/ bench:short

# This also takes integration tests into account.
.PHONY: test\:coverage-full
test\:coverage-full: deps\:go-acc
Expand Down
15 changes: 13 additions & 2 deletions bench/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,23 @@ suite := all

.PHONY: bench
bench:
$(info Running benchmark suite: $(suite))
$(info Running full benchmark suite: $(suite))

ifneq (,$(findstring all,$(suite))) # Check if default ALL value is set
$(eval override suite = ...)
else ifneq ($(wildcard $(suite)/.),) # Check to make sure the requested suite exists
$(eval override suite = $(suite)/...)
endif

go test -bench=. ./$(suite)
go test -bench=. ./$(suite)

.PHONY: bench\:short
bench\:short:
$(info Running short benchmark suite: $(suite))

ifneq (,$(findstring all,$(suite))) # Check if default ALL value is set
$(eval override suite = ...)
else ifneq ($(wildcard $(suite)/.),) # Check to make sure the requested suite exists
$(eval override suite = $(suite)/...)
endif
go test -bench='_1?0{1,4}$$' ./$(suite)
8 changes: 8 additions & 0 deletions bench/collection/simple_create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,14 @@ func Benchmark_Collection_UserSimple_Create_Async_0_1000(b *testing.B) {
}
}

func Benchmark_Collection_UserSimple_Create_Async_0_10000(b *testing.B) {
ctx := context.Background()
err := runCollectionBenchCreate(b, ctx, fixtures.ForSchema(ctx, "user_simple"), 0, 10000, false)
if err != nil {
b.Fatal(err)
}
}

func Benchmark_Collection_UserSimple_Create_Async_0_100000(b *testing.B) {
ctx := context.Background()
err := runCollectionBenchCreate(b, ctx, fixtures.ForSchema(ctx, "user_simple"), 0, 100000, false)
Expand Down
Empty file removed bench/run.sh
Empty file.

0 comments on commit 8dd342f

Please sign in to comment.