-
Notifications
You must be signed in to change notification settings - Fork 5
/
benchmark.cr
69 lines (65 loc) · 905 Bytes
/
benchmark.cr
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
require "benchmark"
require "./src/go_graphql_test_schema.cr"
puts "running the query once to make sure the server works:"
query = %{
query Example($size: Int) {
a,
b,
x: c
...c
f
...on DataType {
pic(size: $size)
promise {
a
}
}
deep {
a
b
c
deeper {
a
b
}
}
}
fragment c on DataType {
d
e
}
}
puts Kemal::GraphQL::GO_GRAPHQL_TEST_SCHEMA.execute(query, {"size" => 50}).to_pretty_json
Benchmark.ips do |x|
x.report("running go_graphqls benchmark schema") do
query = %{
query Example($size: Int) {
a,
b,
x: c
...c
f
...on DataType {
pic(size: $size)
promise {
a
}
}
deep {
a
b
c
deeper {
a
b
}
}
}
fragment c on DataType {
d
e
}
}
Kemal::GraphQL::GO_GRAPHQL_TEST_SCHEMA.execute(query, {"size" => 50})
end
end