-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
42 lines (33 loc) · 1.62 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
GOPATH := $(shell go env GOPATH)
.DEFAULT_GOAL := bench
.PHONY: clean
clean:
git clean -xdf
.PHONY: generate
generate: schema/proto.pb.go schema/proto_vtproto.pb.go schema/karmem_generated.go
.PHONY: test
test:
go test -race ./...
.PHONY: bench
bench: generate
mkdir -p result
go test -tags proto -bench=. -benchmem -count=5 github.com/leki75/iceprotobench/benchmark | tee result/proto.out
go test -tags protovt -bench=. -benchmem -count=5 github.com/leki75/iceprotobench/benchmark | tee result/protovt.out
go test -tags karmem -bench=. -benchmem -count=5 github.com/leki75/iceprotobench/benchmark | tee result/karmem.out
go test -tags raw -bench=. -benchmem -count=5 github.com/leki75/iceprotobench/benchmark | tee result/raw.out
go test -tags rawunsafe -bench=. -benchmem -count=5 github.com/leki75/iceprotobench/benchmark | tee result/rawunsafe.out
go install golang.org/x/perf/cmd/benchstat
benchstat result/proto.out result/protovt.out result/karmem.out result/raw.out result/rawunsafe.out
schema/proto.pb.go: schema/proto.proto
go install google.golang.org/protobuf/cmd/protoc-gen-go
protoc --go_out=. --go_opt=paths=source_relative ./schema/proto.proto
schema/proto_vtproto.pb.go: schema/proto.proto
go install github.com/planetscale/vtprotobuf/cmd/protoc-gen-go-vtproto
protoc \
--plugin protoc-gen-go-vtproto="$(GOPATH)/bin/protoc-gen-go-vtproto" \
--go-vtproto_out=. \
--go-vtproto_opt=paths=source_relative \
--go-vtproto_opt=features=marshal+unmarshal+size \
./schema/proto.proto
schema/karmem_generated.go: schema/karmem.km
go run karmem.org/cmd/karmem build --golang -o "schema" schema/karmem.km