-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
307 lines (261 loc) · 10.1 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
.DEFAULT_GOAL := all
SCHEMAS = $(notdir $(wildcard schemas/*))
ALL_IMPLEMENTATIONS = $(notdir $(wildcard implementations/*))
ifeq ($(NO_IGNORE),yes)
IMPLEMENTATIONS ?= $(ALL_IMPLEMENTATIONS)
else
IMPLEMENTATIONS ?= $(filter-out $(patsubst implementations/%/,%,$(dir $(wildcard implementations/*/.benchmark-ignore))), $(ALL_IMPLEMENTATIONS))
endif
RUNS := 3
BLAZE_BRANCH ?= main
.PHONY: clean
clean: ; rm -rf dist implementations/*/.dockertimestamp
dist: ; mkdir $@
dist/results: | dist ; mkdir $@
dist/results/plots: | dist/results ; mkdir $@
dist/temp: | dist ; mkdir $@
define PREPARE_IMPLEMENTATION
dist/results/$1: | dist/results ; mkdir $$@
dist/temp/$1: | dist/temp ; mkdir $$@
ALL_TARGETS += $$(addprefix dist/results/$1/,$(SCHEMAS))
endef
ALL_PLOTS := $(foreach schema,$(SCHEMAS),dist/results/plots/$(schema).png)
ALL_SCHEMAS := $(foreach schema,$(SCHEMAS),schemas/$(schema)/schema-noformat.json)
ALL_INSTANCES := $(foreach schema,$(SCHEMAS),schemas/$(schema)/instances.jsonl)
$(foreach implementation,$(IMPLEMENTATIONS),$(eval $(call PREPARE_IMPLEMENTATION,$(implementation))))
dist/report.csv: report.sh $(ALL_TARGETS) | dist ; ./$< $(ALL_TARGETS) > $@
dist/summary.csv: \
$(ALL_SCHEMAS) \
$(ALL_INSTANCES) \
dataset_summary.sh
./dataset_summary.sh csv > $@
dist/results/compile.svg dist/results/compile.png: \
dist/report.csv \
dist/summary.csv \
plot_compile.py
uv run python plot_compile.py
dist/results/plots/%.png: \
dist/results/plots \
dist/report.csv \
plot.py \
schemas/%/schema-noformat.json \
schemas/%/instances.jsonl
uv run python plot.py
plots: $(ALL_PLOTS)
.PHONY: all
all: dist/report.csv ; cat $<
define docker_run
$(eval $@_TOOL = $(1))
$(eval $@_INPUT = $(2))
rm -f $@
for i in $(shell seq 1 $(RUNS)) ; do \
timeout -s KILL $$(( $(RUNS) * 180 + 60 ))s docker run --rm -v $(CURDIR):/workspace jsonschema-benchmark/$($@_TOOL) $($@_INPUT) > [email protected] ; \
STATUS=$$? ; \
if [ ! -s [email protected] ]; then echo "0,0,0" >> $@ ; else cat [email protected] >> $@ ; fi ; \
sed -i "$$ s/$$/,$$STATUS/" $@ ; \
rm -f [email protected] ; \
done
endef
list:
@echo $(IMPLEMENTATIONS) | tr ' ' '\n'
schemas/%/schema-noformat.json: schemas/%/schema.json
gron $< | grep -v 'format = "' | gron -u > $@
# Blaze
implementations/blaze/.dockertimestamp: \
implementations/blaze/CMakeLists.txt \
implementations/blaze/main.cc \
implementations/blaze/Dockerfile
docker build --build-arg BLAZE_BRANCH=$(BLAZE_BRANCH) -t jsonschema-benchmark/blaze implementations/blaze
touch $@
dist/results/blaze/%: \
implementations/blaze/.dockertimestamp \
schemas/%/schema-noformat.json \
schemas/%/instances.jsonl \
| dist/results/blaze
@$(call docker_run,blaze,/workspace/$(dir $(word 2,$^)))
# AJV
implementations/ajv/.dockertimestamp: \
implementations/ajv/main.mjs \
implementations/ajv/package.json \
implementations/ajv/package-lock.json \
implementations/ajv/Dockerfile
docker build -t jsonschema-benchmark/ajv implementations/ajv
touch $@
dist/results/ajv/%: \
implementations/ajv/.dockertimestamp \
schemas/%/schema-noformat.json \
schemas/%/instances.jsonl \
| dist/results/ajv
@$(call docker_run,ajv,/workspace/$(word 2,$^) /workspace/$(word 3,$^))
# AJV with bun
implementations/ajv-bun/.dockertimestamp: \
implementations/ajv/main.mjs \
implementations/ajv-bun/package.json \
implementations/ajv-bun/bun.lockb \
implementations/ajv-bun/Dockerfile
cp implementations/ajv/main.mjs implementations/ajv-bun
docker build -t jsonschema-benchmark/ajv-bun implementations/ajv-bun
touch $@
dist/results/ajv-bun/%: \
implementations/ajv-bun/.dockertimestamp \
schemas/%/schema-noformat.json \
schemas/%/instances.jsonl \
| dist/results/ajv-bun
@$(call docker_run,ajv-bun,/workspace/$(word 2,$^) /workspace/$(word 3,$^))
# BOON
implementations/boon/.dockertimestamp: \
implementations/boon/src/main.rs \
implementations/boon/Cargo.toml \
implementations/boon/Dockerfile
docker build -t jsonschema-benchmark/boon implementations/boon
touch $@
dist/results/boon/%: \
implementations/boon/.dockertimestamp \
schemas/%/schema-noformat.json \
schemas/%/instances.jsonl \
| dist/results/boon
@$(call docker_run,boon,/workspace/$(dir $(word 2,$^)))
# JSON_SCHEMER
implementations/json_schemer/.dockertimestamp: \
implementations/json_schemer/main.rb \
implementations/json_schemer/Gemfile \
implementations/json_schemer/Gemfile.lock \
implementations/json_schemer/Dockerfile
docker build -t jsonschema-benchmark/json_schemer implementations/json_schemer
touch $@
dist/results/json_schemer/%: \
implementations/json_schemer/.dockertimestamp \
schemas/%/schema-noformat.json \
schemas/%/instances.jsonl \
| dist/results/json_schemer
@$(call docker_run,json_schemer,/workspace/$(dir $(word 3,$^)))
# PYTHON / JSONSCHEMA
implementations/python-jsonschema/.dockertimestamp: \
implementations/python-jsonschema/validate.py \
implementations/python-jsonschema/pyproject.toml \
implementations/python-jsonschema/uv.lock \
implementations/python-jsonschema/Dockerfile
docker build -t jsonschema-benchmark/python-jsonschema implementations/python-jsonschema
touch $@
dist/results/python-jsonschema/%: \
implementations/python-jsonschema/.dockertimestamp \
schemas/%/schema-noformat.json \
schemas/%/instances.jsonl \
| dist/results/python-jsonschema
@$(call docker_run,python-jsonschema,/workspace/$(dir $(word 2,$^)))
# GO / JSONSCHEMA
implementations/go-jsonschema/.dockertimestamp: \
implementations/go-jsonschema/go.mod \
implementations/go-jsonschema/go.sum \
implementations/go-jsonschema/main.go \
implementations/go-jsonschema/Dockerfile
docker build -t jsonschema-benchmark/go-jsonschema implementations/go-jsonschema
touch $@
dist/results/go-jsonschema/%: \
implementations/go-jsonschema/.dockertimestamp \
schemas/%/schema-noformat.json \
schemas/%/instances.jsonl \
| dist/results/go-jsonschema
@$(call docker_run,go-jsonschema,/workspace/$(dir $(word 2,$^)))
# HYPERJUMP
implementations/hyperjump/.dockertimestamp: \
implementations/hyperjump/main.mjs \
implementations/hyperjump/package.json \
implementations/hyperjump/package-lock.json \
implementations/hyperjump/Dockerfile
docker build -t jsonschema-benchmark/hyperjump implementations/hyperjump
touch $@
dist/results/hyperjump/%: \
implementations/hyperjump/.dockertimestamp \
schemas/%/schema-noformat.json \
schemas/%/instances.jsonl \
| dist/results/hyperjump
@$(call docker_run,hyperjump,/workspace/$(word 2,$^) /workspace/$(word 3,$^))
# JSONCONS
implementations/jsoncons/.dockertimestamp: \
implementations/jsoncons/CMakeLists.txt \
implementations/jsoncons/vcpkg.json \
implementations/jsoncons/vcpkg-configuration.json \
implementations/jsoncons/main.cc \
implementations/jsoncons/Dockerfile
docker build -t jsonschema-benchmark/jsoncons implementations/jsoncons
touch $@
dist/results/jsoncons/%: \
implementations/jsoncons/.dockertimestamp \
schemas/%/schema-noformat.json \
schemas/%/instances.jsonl \
| dist/results/jsoncons
@$(call docker_run,jsoncons,/workspace/$(dir $(word 2,$^)))
# DOTNET / CORVUS
implementations/corvus/.dockertimestamp: \
implementations/corvus/bench.csproj \
implementations/corvus/Program.cs \
implementations/corvus/generate-and-run.sh \
implementations/corvus/Dockerfile
docker build -t jsonschema-benchmark/corvus implementations/corvus
touch $@
dist/results/corvus/%: \
implementations/corvus/.dockertimestamp \
schemas/%/schema-noformat.json \
schemas/%/instances.jsonl \
| dist/results/corvus
@$(call docker_run,corvus,/workspace/$(word 2,$^) /workspace/$(word 3,$^))
# SCHEMASAFE
implementations/schemasafe/.dockertimestamp: \
implementations/schemasafe/main.mjs \
implementations/schemasafe/package.json \
implementations/schemasafe/package-lock.json \
implementations/schemasafe/Dockerfile
docker build -t jsonschema-benchmark/schemasafe implementations/schemasafe
touch $@
dist/results/schemasafe/%: \
implementations/schemasafe/.dockertimestamp \
schemas/%/schema-noformat.json \
schemas/%/instances.jsonl \
| dist/results/schemasafe
@$(call docker_run,schemasafe,/workspace/$(word 2,$^) /workspace/$(word 3,$^))
# JsonSchema.net
implementations/jsonschemadotnet/.dockertimestamp: \
implementations/jsonschemadotnet/bench.csproj \
implementations/jsonschemadotnet/Program.cs \
implementations/jsonschemadotnet/Dockerfile
docker build -t jsonschema-benchmark/jsonschemadotnet implementations/jsonschemadotnet
touch $@
dist/results/jsonschemadotnet/%: \
implementations/jsonschemadotnet/.dockertimestamp \
schemas/%/schema-noformat.json \
schemas/%/instances.jsonl \
| dist/results/jsonschemadotnet
@$(call docker_run,jsonschemadotnet,/workspace/$(word 2,$^) /workspace/$(word 3,$^))
# kmp-json-schema-validator
implementations/kmp-json-schema-validator/.dockertimestamp: \
implementations/kmp-json-schema-validator/app/src/main/kotlin/io/github/sourcemeta/App.kt \
implementations/kmp-json-schema-validator/app/build.gradle.kts \
implementations/kmp-json-schema-validator/gradle/libs.versions.toml \
implementations/kmp-json-schema-validator/gradle/wrapper/gradle-wrapper.properties \
implementations/kmp-json-schema-validator/run.sh \
implementations/kmp-json-schema-validator/Dockerfile
docker build -t jsonschema-benchmark/kmp-json-schema-validator implementations/kmp-json-schema-validator
touch $@
dist/results/kmp-json-schema-validator/%: \
implementations/kmp-json-schema-validator/.dockertimestamp \
schemas/%/schema-noformat.json \
schemas/%/instances.jsonl \
| dist/results/kmp-json-schema-validator
@$(call docker_run,kmp-json-schema-validator,/workspace/$(word 2,$^) /workspace/$(word 3,$^))
# networknt
implementations/networknt/.dockertimestamp: \
implementations/networknt/app/src/main/java/io/github/sourcemeta/*.java \
implementations/networknt/app/build.gradle.kts \
implementations/networknt/gradle/libs.versions.toml \
implementations/networknt/gradle/wrapper/gradle-wrapper.properties \
implementations/networknt/run.sh \
implementations/networknt/Dockerfile
docker build -t jsonschema-benchmark/networknt implementations/networknt
touch $@
dist/results/networknt/%: \
implementations/networknt/.dockertimestamp \
schemas/%/schema-noformat.json \
schemas/%/instances.jsonl \
| dist/results/networknt
@$(call docker_run,networknt,/workspace/$(word 2,$^) /workspace/$(word 3,$^))