Debian Codegraph @

benchmarks/Makefile

raw
1 benchmark.dir ?= results
2 benchmark.batch ?= 1000
3 benchmark.count ?= 8
4
5 benchmark.encoding.json := $(benchmark.dir)/encoding-json
6 benchmark.github.com.json-iterator.go := $(benchmark.dir)/json-iterator
7 benchmark.github.com.segmentio.encoding.json := $(benchmark.dir)/segment-encoding-json
8 benchmark.github.com.mailru.easyjson := $(benchmark.dir)/easyjson
9 benchmark.github.com.protobuf.v1 := $(benchmark.dir)/segment-protobuf-v1
10 benchmark.vmihailenco.msgpack := $(benchmark.dir)/vmihailenco-msgpack
11 benchmark.tinylib.msgp := $(benchmark.dir)/tinylib-msgp
12
13 benchmark.encoding.json.gzip := $(benchmark.dir)/encoding-json+gzip
14 benchmark.github.com.json-iterator.go.gzip := $(benchmark.dir)/json-iterator+gzip
15 benchmark.github.com.segmentio.encoding.json.gzip := $(benchmark.dir)/segment-encoding-json+gzip
16 benchmark.github.com.mailru.easyjson.gzip := $(benchmark.dir)/easyjson+gzip
17 benchmark.github.com.protobuf.v1.gzip := $(benchmark.dir)/segment-protobuf-v1+gzip
18 benchmark.vmihailenco.msgpack.gzip := $(benchmark.dir)/vmihailenco-msgpack+gzip
19 benchmark.tinylib.msgp.gzip := $(benchmark.dir)/tinylib-msgp+gzip
20
21 benchmark.encoding.json.snappy := $(benchmark.dir)/encoding-json+snappy
22 benchmark.github.com.json-iterator.go.snappy := $(benchmark.dir)/json-iterator+snappy
23 benchmark.github.com.segmentio.encoding.json.snappy := $(benchmark.dir)/segment-encoding-json+snappy
24 benchmark.github.com.mailru.easyjson.snappy := $(benchmark.dir)/easyjson+snappy
25 benchmark.github.com.protobuf.v1.snappy := $(benchmark.dir)/segment-protobuf-v1+snappy
26 benchmark.vmihailenco.msgpack.snappy := $(benchmark.dir)/vmihailenco-msgpack+snappy
27 benchmark.tinylib.msgp.snappy := $(benchmark.dir)/tinylib-msgp+snappy
28
29 benchmark.encoding.json.zstd := $(benchmark.dir)/encoding-json+zstd
30 benchmark.github.com.json-iterator.go.zstd := $(benchmark.dir)/json-iterator+zstd
31 benchmark.github.com.segmentio.encoding.json.zstd := $(benchmark.dir)/segment-encoding-json+zstd
32 benchmark.github.com.mailru.easyjson.zstd := $(benchmark.dir)/easyjson+zstd
33 benchmark.github.com.protobuf.v1.zstd := $(benchmark.dir)/segment-protobuf-v1+zstd
34 benchmark.vmihailenco.msgpack.zstd := $(benchmark.dir)/vmihailenco-msgpack+zstd
35 benchmark.tinylib.msgp.zstd := $(benchmark.dir)/tinylib-msgp+zstd
36
37 benchmark.data := ../json/testdata/msgs.json.gz
38 benchmark.msgs := $(benchmark.dir)/msgs.json
39 benchmark.bin := $(benchmark.dir)/benchmark
40 benchmark.cmd.dir := cmd/benchmark
41 benchmark.src := $(wildcard ./$(benchmark.cmd.dir)/*.go)
42 benchmark.out := \
43 $(benchmark.encoding.json).txt \
44 $(benchmark.github.com.json-iterator.go).txt \
45 $(benchmark.github.com.segmentio.encoding.json).txt \
46 $(benchmark.github.com.mailru.easyjson).txt \
47 $(benchmark.github.com.protobuf.v1).txt \
48 $(benchmark.vmihailenco.msgpack).txt \
49 $(benchmark.tinylib.msgp).txt \
50 $(benchmark.encoding.json.gzip).txt \
51 $(benchmark.github.com.json-iterator.go.gzip).txt \
52 $(benchmark.github.com.segmentio.encoding.json.gzip).txt \
53 $(benchmark.github.com.mailru.easyjson.gzip).txt \
54 $(benchmark.github.com.protobuf.v1.gzip).txt \
55 $(benchmark.vmihailenco.msgpack.gzip).txt \
56 $(benchmark.tinylib.msgp.gzip).txt \
57 $(benchmark.encoding.json.snappy).txt \
58 $(benchmark.github.com.json-iterator.go.snappy).txt \
59 $(benchmark.github.com.segmentio.encoding.json.snappy).txt \
60 $(benchmark.github.com.mailru.easyjson.snappy).txt \
61 $(benchmark.github.com.protobuf.v1.snappy).txt \
62 $(benchmark.vmihailenco.msgpack.snappy).txt \
63 $(benchmark.tinylib.msgp.snappy).txt \
64 $(benchmark.encoding.json.zstd).txt \
65 $(benchmark.github.com.json-iterator.go.zstd).txt \
66 $(benchmark.github.com.segmentio.encoding.json.zstd).txt \
67 $(benchmark.github.com.mailru.easyjson.zstd).txt \
68 $(benchmark.github.com.protobuf.v1.zstd).txt \
69 $(benchmark.vmihailenco.msgpack.zstd).txt \
70 $(benchmark.tinylib.msgp.zstd).txt
71
72 benchstat := ${GOPATH}/bin/benchstat
73
74 all:
75
76 $(benchstat):
77 go install golang.org/x/perf/cmd/benchstat@latest
78
79 $(benchmark.cmd.dir)/message.pb.go: $(benchmark.cmd.dir)/message.proto
80 @protoc -I. \
81 -I$(GOPATH)/src \
82 -I$(GOPATH)/src/github.com/gogo/protobuf/protobuf \
83 --gogofaster_out=\
84 Mgoogle/protobuf/struct.proto=github.com/gogo/protobuf/types,\
85 Mgoogle/protobuf/timestamp.proto=github.com/gogo/protobuf/types:.\
86 $(benchmark.cmd.dir)/message.proto
87
88 bench: $(benchstat) $(benchmark.out)
89 @for file in $(benchmark.out); do \
90 echo '======' $$(basename $$file | sed 's/.txt//') '======'; \
91 cat $$(echo $$file | sed 's/.txt/.log/'); \
92 echo; \
93 $(benchstat) $(benchmark.encoding.json).txt $$file; \
94 echo; \
95 done
96
97 $(benchmark.dir):
98 mkdir -p $(benchmark.dir)
99
100 $(benchmark.bin): $(benchmark.src)
101 go build -o $(benchmark.bin) ./$(benchmark.cmd.dir)
102
103 $(benchmark.msgs): $(benchmark.dir) $(benchmark.data)
104 cat $(benchmark.data) | gzip -d > $(benchmark.msgs)
105
106 $(benchmark.encoding.json).txt: $(benchmark.msgs) $(benchmark.bin)
107 cat $(benchmark.msgs) | $(benchmark.bin) -count $(benchmark.count) -batch $(benchmark.batch) -package encoding/json \
108 1> $(benchmark.encoding.json).txt \
109 2> $(benchmark.encoding.json).log
110
111 $(benchmark.github.com.json-iterator.go).txt: $(benchmark.msgs) $(benchmark.bin)
112 cat $(benchmark.msgs) | $(benchmark.bin) -count $(benchmark.count) -batch $(benchmark.batch) -package github.com/json-iterator/go \
113 1> $(benchmark.github.com.json-iterator.go).txt \
114 2> $(benchmark.github.com.json-iterator.go).log
115
116 $(benchmark.github.com.segmentio.encoding.json).txt: $(benchmark.msgs) $(benchmark.bin)
117 cat $(benchmark.msgs) | $(benchmark.bin) -count $(benchmark.count) -batch $(benchmark.batch) -package github.com/segmentio/encoding/json \
118 1> $(benchmark.github.com.segmentio.encoding.json).txt \
119 2> $(benchmark.github.com.segmentio.encoding.json).log
120
121 $(benchmark.github.com.mailru.easyjson).txt: $(benchmark.msgs) $(benchmark.bin)
122 cat $(benchmark.msgs) | $(benchmark.bin) -count $(benchmark.count) -batch $(benchmark.batch) -package github.com/mailru/easyjson \
123 1> $(benchmark.github.com.mailru.easyjson).txt \
124 2> $(benchmark.github.com.mailru.easyjson).log
125
126 $(benchmark.github.com.protobuf.v1).txt: $(benchmark.msgs) $(benchmark.bin)
127 cat $(benchmark.msgs) | $(benchmark.bin) -count $(benchmark.count) -batch $(benchmark.batch) -package github.com/segmentio/protobuf/v1 \
128 1> $(benchmark.github.com.protobuf.v1).txt \
129 2> $(benchmark.github.com.protobuf.v1).log
130
131 $(benchmark.vmihailenco.msgpack).txt: $(benchmark.msgs) $(benchmark.bin)
132 cat $(benchmark.msgs) | $(benchmark.bin) -count $(benchmark.count) -batch $(benchmark.batch) -package github.com/vmihailenco/msgpack \
133 1> $(benchmark.vmihailenco.msgpack).txt \
134 2> $(benchmark.vmihailenco.msgpack).log
135
136 $(benchmark.tinylib.msgp).txt: $(benchmark.msgs) $(benchmark.bin)
137 cat $(benchmark.msgs) | $(benchmark.bin) -count $(benchmark.count) -batch $(benchmark.batch) -package github.com/tinylib/msgp \
138 1> $(benchmark.tinylib.msgp).txt \
139 2> $(benchmark.tinylib.msgp).log
140
141 $(benchmark.encoding.json.gzip).txt: $(benchmark.msgs) $(benchmark.bin)
142 cat $(benchmark.msgs) | $(benchmark.bin) -count $(benchmark.count) -batch $(benchmark.batch) -package encoding/json -compression gzip \
143 1> $(benchmark.encoding.json.gzip).txt \
144 2> $(benchmark.encoding.json.gzip).log
145
146 $(benchmark.github.com.json-iterator.go.gzip).txt: $(benchmark.msgs) $(benchmark.bin)
147 cat $(benchmark.msgs) | $(benchmark.bin) -count $(benchmark.count) -batch $(benchmark.batch) -package github.com/json-iterator/go -compression gzip \
148 1> $(benchmark.github.com.json-iterator.go.gzip).txt \
149 2> $(benchmark.github.com.json-iterator.go.gzip).log
150
151 $(benchmark.github.com.segmentio.encoding.json.gzip).txt: $(benchmark.msgs) $(benchmark.bin)
152 cat $(benchmark.msgs) | $(benchmark.bin) -count $(benchmark.count) -batch $(benchmark.batch) -package github.com/segmentio/encoding/json -compression gzip \
153 1> $(benchmark.github.com.segmentio.encoding.json.gzip).txt \
154 2> $(benchmark.github.com.segmentio.encoding.json.gzip).log
155
156 $(benchmark.github.com.mailru.easyjson.gzip).txt: $(benchmark.msgs) $(benchmark.bin)
157 cat $(benchmark.msgs) | $(benchmark.bin) -count $(benchmark.count) -batch $(benchmark.batch) -package github.com/mailru/easyjson -compression gzip \
158 1> $(benchmark.github.com.mailru.easyjson.gzip).txt \
159 2> $(benchmark.github.com.mailru.easyjson.gzip).log
160
161 $(benchmark.github.com.protobuf.v1.gzip).txt: $(benchmark.msgs) $(benchmark.bin)
162 cat $(benchmark.msgs) | $(benchmark.bin) -count $(benchmark.count) -batch $(benchmark.batch) -package github.com/segmentio/protobuf/v1 -compression gzip \
163 1> $(benchmark.github.com.protobuf.v1.gzip).txt \
164 2> $(benchmark.github.com.protobuf.v1.gzip).log
165
166 $(benchmark.vmihailenco.msgpack.gzip).txt: $(benchmark.msgs) $(benchmark.bin)
167 cat $(benchmark.msgs) | $(benchmark.bin) -count $(benchmark.count) -batch $(benchmark.batch) -package github.com/vmihailenco/msgpack -compression gzip \
168 1> $(benchmark.vmihailenco.msgpack.gzip).txt \
169 2> $(benchmark.vmihailenco.msgpack.gzip).log
170
171 $(benchmark.tinylib.msgp.gzip).txt: $(benchmark.msgs) $(benchmark.bin)
172 cat $(benchmark.msgs) | $(benchmark.bin) -count $(benchmark.count) -batch $(benchmark.batch) -package github.com/tinylib/msgp -compression gzip \
173 1> $(benchmark.tinylib.msgp.gzip).txt \
174 2> $(benchmark.tinylib.msgp.gzip).log
175
176 $(benchmark.encoding.json.snappy).txt: $(benchmark.msgs) $(benchmark.bin)
177 cat $(benchmark.msgs) | $(benchmark.bin) -count $(benchmark.count) -batch $(benchmark.batch) -package encoding/json -compression snappy \
178 1> $(benchmark.encoding.json.snappy).txt \
179 2> $(benchmark.encoding.json.snappy).log
180
181 $(benchmark.github.com.json-iterator.go.snappy).txt: $(benchmark.msgs) $(benchmark.bin)
182 cat $(benchmark.msgs) | $(benchmark.bin) -count $(benchmark.count) -batch $(benchmark.batch) -package github.com/json-iterator/go -compression snappy \
183 1> $(benchmark.github.com.json-iterator.go.snappy).txt \
184 2> $(benchmark.github.com.json-iterator.go.snappy).log
185
186 $(benchmark.github.com.segmentio.encoding.json.snappy).txt: $(benchmark.msgs) $(benchmark.bin)
187 cat $(benchmark.msgs) | $(benchmark.bin) -count $(benchmark.count) -batch $(benchmark.batch) -package github.com/segmentio/encoding/json -compression snappy \
188 1> $(benchmark.github.com.segmentio.encoding.json.snappy).txt \
189 2> $(benchmark.github.com.segmentio.encoding.json.snappy).log
190
191 $(benchmark.github.com.mailru.easyjson.snappy).txt: $(benchmark.msgs) $(benchmark.bin)
192 cat $(benchmark.msgs) | $(benchmark.bin) -count $(benchmark.count) -batch $(benchmark.batch) -package github.com/mailru/easyjson -compression snappy \
193 1> $(benchmark.github.com.mailru.easyjson.snappy).txt \
194 2> $(benchmark.github.com.mailru.easyjson.snappy).log
195
196 $(benchmark.github.com.protobuf.v1.snappy).txt: $(benchmark.msgs) $(benchmark.bin)
197 cat $(benchmark.msgs) | $(benchmark.bin) -count $(benchmark.count) -batch $(benchmark.batch) -package github.com/segmentio/protobuf/v1 -compression snappy \
198 1> $(benchmark.github.com.protobuf.v1.snappy).txt \
199 2> $(benchmark.github.com.protobuf.v1.snappy).log
200
201 $(benchmark.vmihailenco.msgpack.snappy).txt: $(benchmark.msgs) $(benchmark.bin)
202 cat $(benchmark.msgs) | $(benchmark.bin) -count $(benchmark.count) -batch $(benchmark.batch) -package github.com/vmihailenco/msgpack -compression snappy \
203 1> $(benchmark.vmihailenco.msgpack.snappy).txt \
204 2> $(benchmark.vmihailenco.msgpack.snappy).log
205
206 $(benchmark.tinylib.msgp.snappy).txt: $(benchmark.msgs) $(benchmark.bin)
207 cat $(benchmark.msgs) | $(benchmark.bin) -count $(benchmark.count) -batch $(benchmark.batch) -package github.com/tinylib/msgp -compression snappy \
208 1> $(benchmark.tinylib.msgp.snappy).txt \
209 2> $(benchmark.tinylib.msgp.snappy).log
210
211 $(benchmark.encoding.json.zstd).txt: $(benchmark.msgs) $(benchmark.bin)
212 cat $(benchmark.msgs) | $(benchmark.bin) -count $(benchmark.count) -batch $(benchmark.batch) -package encoding/json -compression zstd \
213 1> $(benchmark.encoding.json.zstd).txt \
214 2> $(benchmark.encoding.json.zstd).log
215
216 $(benchmark.github.com.json-iterator.go.zstd).txt: $(benchmark.msgs) $(benchmark.bin)
217 cat $(benchmark.msgs) | $(benchmark.bin) -count $(benchmark.count) -batch $(benchmark.batch) -package github.com/json-iterator/go -compression zstd \
218 1> $(benchmark.github.com.json-iterator.go.zstd).txt \
219 2> $(benchmark.github.com.json-iterator.go.zstd).log
220
221 $(benchmark.github.com.segmentio.encoding.json.zstd).txt: $(benchmark.msgs) $(benchmark.bin)
222 cat $(benchmark.msgs) | $(benchmark.bin) -count $(benchmark.count) -batch $(benchmark.batch) -package github.com/segmentio/encoding/json -compression zstd \
223 1> $(benchmark.github.com.segmentio.encoding.json.zstd).txt \
224 2> $(benchmark.github.com.segmentio.encoding.json.zstd).log
225
226 $(benchmark.github.com.mailru.easyjson.zstd).txt: $(benchmark.msgs) $(benchmark.bin)
227 cat $(benchmark.msgs) | $(benchmark.bin) -count $(benchmark.count) -batch $(benchmark.batch) -package github.com/mailru/easyjson -compression zstd \
228 1> $(benchmark.github.com.mailru.easyjson.zstd).txt \
229 2> $(benchmark.github.com.mailru.easyjson.zstd).log
230
231 $(benchmark.github.com.protobuf.v1.zstd).txt: $(benchmark.msgs) $(benchmark.bin)
232 cat $(benchmark.msgs) | $(benchmark.bin) -count $(benchmark.count) -batch $(benchmark.batch) -package github.com/segmentio/protobuf/v1 -compression zstd \
233 1> $(benchmark.github.com.protobuf.v1.zstd).txt \
234 2> $(benchmark.github.com.protobuf.v1.zstd).log
235
236 $(benchmark.vmihailenco.msgpack.zstd).txt: $(benchmark.msgs) $(benchmark.bin)
237 cat $(benchmark.msgs) | $(benchmark.bin) -count $(benchmark.count) -batch $(benchmark.batch) -package github.com/vmihailenco/msgpack -compression zstd \
238 1> $(benchmark.vmihailenco.msgpack.zstd).txt \
239 2> $(benchmark.vmihailenco.msgpack.zstd).log
240
241 $(benchmark.tinylib.msgp.zstd).txt: $(benchmark.msgs) $(benchmark.bin)
242 cat $(benchmark.msgs) | $(benchmark.bin) -count $(benchmark.count) -batch $(benchmark.batch) -package github.com/tinylib/msgp -compression zstd \
243 1> $(benchmark.tinylib.msgp.zstd).txt \
244 2> $(benchmark.tinylib.msgp.zstd).log