bluejay 0.1.0.alpha.2-x86_64-linux
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.md +411 -0
- data/lib/bluejay/3.1/bluejay_rb.so +0 -0
- data/lib/bluejay/3.2/bluejay_rb.so +0 -0
- data/lib/bluejay/base/custom_scalar_type.rb +25 -0
- data/lib/bluejay/base/directive.rb +25 -0
- data/lib/bluejay/base/enum_type.rb +25 -0
- data/lib/bluejay/base/input_object_type.rb +25 -0
- data/lib/bluejay/base/interface_type.rb +25 -0
- data/lib/bluejay/base/object_type.rb +25 -0
- data/lib/bluejay/base/query_root.rb +25 -0
- data/lib/bluejay/base/schema.rb +25 -0
- data/lib/bluejay/base/union_type.rb +25 -0
- data/lib/bluejay/base.rb +11 -0
- data/lib/bluejay/base_input_type.rb +13 -0
- data/lib/bluejay/base_output_type.rb +15 -0
- data/lib/bluejay/builtin/directives/deprecated.rb +34 -0
- data/lib/bluejay/builtin/directives/include.rb +35 -0
- data/lib/bluejay/builtin/directives/skip.rb +35 -0
- data/lib/bluejay/builtin/directives/specified_by.rb +33 -0
- data/lib/bluejay/builtin/enum_types/directive_location.rb +44 -0
- data/lib/bluejay/builtin/enum_types/type_kind.rb +33 -0
- data/lib/bluejay/builtin/object_types/directive.rb +34 -0
- data/lib/bluejay/builtin/object_types/enum_value.rb +33 -0
- data/lib/bluejay/builtin/object_types/field.rb +35 -0
- data/lib/bluejay/builtin/object_types/input_value.rb +29 -0
- data/lib/bluejay/builtin/object_types/schema.rb +31 -0
- data/lib/bluejay/builtin/object_types/type.rb +57 -0
- data/lib/bluejay/builtin.rb +25 -0
- data/lib/bluejay/custom_scalar_type.rb +69 -0
- data/lib/bluejay/directive.rb +71 -0
- data/lib/bluejay/enum_type.rb +48 -0
- data/lib/bluejay/errors.rb +20 -0
- data/lib/bluejay/finalize.rb +27 -0
- data/lib/bluejay/input_object_type.rb +73 -0
- data/lib/bluejay/input_type_shorthands.rb +28 -0
- data/lib/bluejay/interface_type.rb +74 -0
- data/lib/bluejay/json_value.rb +16 -0
- data/lib/bluejay/name_from_class.rb +18 -0
- data/lib/bluejay/object_type.rb +81 -0
- data/lib/bluejay/output_type_shorthands.rb +28 -0
- data/lib/bluejay/query_root.rb +64 -0
- data/lib/bluejay/schema.rb +91 -0
- data/lib/bluejay/union_type.rb +50 -0
- data/lib/bluejay/version.rb +5 -0
- data/lib/bluejay.rb +45 -0
- data/lib/rbi_ext/model.rb +64 -0
- data/lib/tapioca/dsl/compilers/directive.rb +42 -0
- data/lib/tapioca/dsl/compilers/input_object_type.rb +41 -0
- data/lib/tapioca/dsl/compilers/interface_type.rb +33 -0
- data/lib/tapioca/dsl/compilers/object_type.rb +53 -0
- data/lib/tapioca/dsl/compilers/schema.rb +51 -0
- data/rust-toolchain.toml +2 -0
- metadata +118 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e91d52ad1256537f831185f293a7da7eb5ed6a870e96e46a765fec9593ac6105
|
4
|
+
data.tar.gz: bf3f1918ee8fc5b88b76982692ff071c41985d0f8d12e3b881ec9a2d86bce116
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4a31893ba0356ab973e9c36085b2a795f2c57507e438f5ae4dcaa577653e73b2c2398483990434f6f01d342964867b37334f522f0642da242f0a50b537f09ad9
|
7
|
+
data.tar.gz: 72e6e1ab46ce3b9b6c816e57cb804907403670a1235c7f0133ad599943013411094a07d1f41805587376234ab5b0886a3bdf9f38bcd57ba47a67d4095b8413f4
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2023 Adam Petro
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,411 @@
|
|
1
|
+
# `bluejay-rb`
|
2
|
+
|
3
|
+
> **Warning**
|
4
|
+
> This project is still very early in its development and should be considered highly unstable and experimental. It is incomplete and not ready for production use.
|
5
|
+
|
6
|
+
> **Note**
|
7
|
+
> In an effort to get a working proof-of-concept, documentation and test coverage has been sacrificied. This will be corrected prior to a stable release.
|
8
|
+
|
9
|
+
`bluejay-rb` is a GraphQL engine for Ruby written primarily in Rust through the use of [`magnus`](https://github.com/matsadler/magnus).
|
10
|
+
|
11
|
+
## Goal
|
12
|
+
|
13
|
+
`bluejay-rb`'s goal is to provide a lightning fast GraphQL engine with first-class integration with [Sorbet](https://sorbet.org/). If you do not care deeply about one or both of these goals, then you should seriously consider using the excellent [`graphql-ruby`](https://graphql-ruby.org) gem, which has many more features than `bluejay-rb` in addition to being production-ready and much more customizable.
|
14
|
+
|
15
|
+
## Benchmarks
|
16
|
+
|
17
|
+
Some benchmarks comparing the performance of `bluejay-rb` against `graphql-ruby` (with C parser) are located at [`/bench`](/bench). The results of some of these benchmarks are included below.
|
18
|
+
|
19
|
+
<!---benchmark result start-->
|
20
|
+
<details>
|
21
|
+
<summary>Parse + Execute (Ruby 3.2, YJIT enabled)</summary>
|
22
|
+
|
23
|
+
```
|
24
|
+
Profiling IPS:
|
25
|
+
Warming up --------------------------------------
|
26
|
+
graphql 158.000 i/100ms
|
27
|
+
bluejay 1.764k i/100ms
|
28
|
+
Calculating -------------------------------------
|
29
|
+
graphql 1.928k (± 2.7%) i/s - 9.638k in 5.003328s
|
30
|
+
bluejay 17.899k (± 2.7%) i/s - 89.964k in 5.029921s
|
31
|
+
|
32
|
+
Comparison:
|
33
|
+
bluejay: 17899.5 i/s
|
34
|
+
graphql: 1927.9 i/s - 9.28x slower
|
35
|
+
|
36
|
+
Profiling Ruby memory allocations:
|
37
|
+
Calculating -------------------------------------
|
38
|
+
graphql 45.944k memsize ( 2.736k retained)
|
39
|
+
421.000 objects ( 41.000 retained)
|
40
|
+
12.000 strings ( 11.000 retained)
|
41
|
+
bluejay 5.256k memsize ( 208.000 retained)
|
42
|
+
40.000 objects ( 2.000 retained)
|
43
|
+
0.000 strings ( 0.000 retained)
|
44
|
+
|
45
|
+
Comparison:
|
46
|
+
bluejay: 5256 allocated
|
47
|
+
graphql: 45944 allocated - 8.74x more
|
48
|
+
```
|
49
|
+
</details>
|
50
|
+
|
51
|
+
<details>
|
52
|
+
<summary>Parse + Execute (Ruby 3.2, YJIT disabled)</summary>
|
53
|
+
|
54
|
+
```
|
55
|
+
Profiling IPS:
|
56
|
+
Warming up --------------------------------------
|
57
|
+
graphql 79.000 i/100ms
|
58
|
+
bluejay 1.804k i/100ms
|
59
|
+
Calculating -------------------------------------
|
60
|
+
graphql 781.860 (± 2.2%) i/s - 3.950k in 5.054411s
|
61
|
+
bluejay 18.017k (± 1.6%) i/s - 90.200k in 5.007842s
|
62
|
+
|
63
|
+
Comparison:
|
64
|
+
bluejay: 18016.7 i/s
|
65
|
+
graphql: 781.9 i/s - 23.04x slower
|
66
|
+
|
67
|
+
Profiling Ruby memory allocations:
|
68
|
+
Calculating -------------------------------------
|
69
|
+
graphql 45.944k memsize ( 21.752k retained)
|
70
|
+
421.000 objects ( 197.000 retained)
|
71
|
+
12.000 strings ( 12.000 retained)
|
72
|
+
bluejay 5.256k memsize ( 5.056k retained)
|
73
|
+
40.000 objects ( 35.000 retained)
|
74
|
+
0.000 strings ( 0.000 retained)
|
75
|
+
|
76
|
+
Comparison:
|
77
|
+
bluejay: 5256 allocated
|
78
|
+
graphql: 45944 allocated - 8.74x more
|
79
|
+
```
|
80
|
+
</details>
|
81
|
+
|
82
|
+
<details>
|
83
|
+
<summary>Parse + Execute with large variables (Ruby 3.2, YJIT enabled)</summary>
|
84
|
+
|
85
|
+
```
|
86
|
+
Profiling IPS:
|
87
|
+
Warming up --------------------------------------
|
88
|
+
graphql 166.000 i/100ms
|
89
|
+
bluejay 1.101k i/100ms
|
90
|
+
Calculating -------------------------------------
|
91
|
+
graphql 1.642k (± 2.1%) i/s - 8.300k in 5.055691s
|
92
|
+
bluejay 10.876k (± 1.8%) i/s - 55.050k in 5.063054s
|
93
|
+
|
94
|
+
Comparison:
|
95
|
+
bluejay: 10876.3 i/s
|
96
|
+
graphql: 1642.4 i/s - 6.62x slower
|
97
|
+
|
98
|
+
Profiling Ruby memory allocations:
|
99
|
+
Calculating -------------------------------------
|
100
|
+
graphql 97.728k memsize ( 40.000 retained)
|
101
|
+
885.000 objects ( 1.000 retained)
|
102
|
+
6.000 strings ( 0.000 retained)
|
103
|
+
bluejay 15.640k memsize ( 80.000 retained)
|
104
|
+
228.000 objects ( 2.000 retained)
|
105
|
+
15.000 strings ( 1.000 retained)
|
106
|
+
|
107
|
+
Comparison:
|
108
|
+
bluejay: 15640 allocated
|
109
|
+
graphql: 97728 allocated - 6.25x more
|
110
|
+
```
|
111
|
+
</details>
|
112
|
+
|
113
|
+
<details>
|
114
|
+
<summary>Parse + Execute with large variables (Ruby 3.2, YJIT disabled)</summary>
|
115
|
+
|
116
|
+
```
|
117
|
+
Profiling IPS:
|
118
|
+
Warming up --------------------------------------
|
119
|
+
graphql 79.000 i/100ms
|
120
|
+
bluejay 1.009k i/100ms
|
121
|
+
Calculating -------------------------------------
|
122
|
+
graphql 841.882 (± 1.5%) i/s - 4.266k in 5.068484s
|
123
|
+
bluejay 10.163k (± 2.1%) i/s - 51.459k in 5.065688s
|
124
|
+
|
125
|
+
Comparison:
|
126
|
+
bluejay: 10163.2 i/s
|
127
|
+
graphql: 841.9 i/s - 12.07x slower
|
128
|
+
|
129
|
+
Profiling Ruby memory allocations:
|
130
|
+
Calculating -------------------------------------
|
131
|
+
graphql 97.688k memsize ( 30.736k retained)
|
132
|
+
884.000 objects ( 319.000 retained)
|
133
|
+
6.000 strings ( 5.000 retained)
|
134
|
+
bluejay 12.600k memsize ( 536.000 retained)
|
135
|
+
152.000 objects ( 6.000 retained)
|
136
|
+
8.000 strings ( 1.000 retained)
|
137
|
+
|
138
|
+
Comparison:
|
139
|
+
bluejay: 12600 allocated
|
140
|
+
graphql: 97688 allocated - 7.75x more
|
141
|
+
```
|
142
|
+
</details>
|
143
|
+
|
144
|
+
<details>
|
145
|
+
<summary>Parse small (Ruby 3.2, YJIT enabled)</summary>
|
146
|
+
|
147
|
+
```
|
148
|
+
Profiling IPS:
|
149
|
+
Warming up --------------------------------------
|
150
|
+
bluejay 39.288k i/100ms
|
151
|
+
graphql 6.906k i/100ms
|
152
|
+
Calculating -------------------------------------
|
153
|
+
bluejay 397.916k (± 1.4%) i/s - 2.004M in 5.036417s
|
154
|
+
graphql 67.671k (± 4.9%) i/s - 338.394k in 5.015897s
|
155
|
+
|
156
|
+
Comparison:
|
157
|
+
bluejay: 397915.9 i/s
|
158
|
+
graphql: 67671.2 i/s - 5.88x slower
|
159
|
+
|
160
|
+
Profiling Ruby memory allocations:
|
161
|
+
Calculating -------------------------------------
|
162
|
+
bluejay 0.000 memsize ( 0.000 retained)
|
163
|
+
0.000 objects ( 0.000 retained)
|
164
|
+
0.000 strings ( 0.000 retained)
|
165
|
+
graphql 6.192k memsize ( 2.816k retained)
|
166
|
+
70.000 objects ( 37.000 retained)
|
167
|
+
6.000 strings ( 6.000 retained)
|
168
|
+
|
169
|
+
Comparison:
|
170
|
+
bluejay: 0 allocated
|
171
|
+
graphql: 6192 allocated - Infx more
|
172
|
+
```
|
173
|
+
</details>
|
174
|
+
|
175
|
+
<details>
|
176
|
+
<summary>Parse small (Ruby 3.2, YJIT disabled)</summary>
|
177
|
+
|
178
|
+
```
|
179
|
+
Profiling IPS:
|
180
|
+
Warming up --------------------------------------
|
181
|
+
bluejay 37.618k i/100ms
|
182
|
+
graphql 6.034k i/100ms
|
183
|
+
Calculating -------------------------------------
|
184
|
+
bluejay 403.347k (± 2.1%) i/s - 2.031M in 5.038540s
|
185
|
+
graphql 59.928k (± 2.0%) i/s - 301.700k in 5.036461s
|
186
|
+
|
187
|
+
Comparison:
|
188
|
+
bluejay: 403347.5 i/s
|
189
|
+
graphql: 59928.3 i/s - 6.73x slower
|
190
|
+
|
191
|
+
Profiling Ruby memory allocations:
|
192
|
+
Calculating -------------------------------------
|
193
|
+
bluejay 0.000 memsize ( 0.000 retained)
|
194
|
+
0.000 objects ( 0.000 retained)
|
195
|
+
0.000 strings ( 0.000 retained)
|
196
|
+
graphql 6.192k memsize ( 0.000 retained)
|
197
|
+
70.000 objects ( 0.000 retained)
|
198
|
+
6.000 strings ( 0.000 retained)
|
199
|
+
|
200
|
+
Comparison:
|
201
|
+
bluejay: 0 allocated
|
202
|
+
graphql: 6192 allocated - Infx more
|
203
|
+
```
|
204
|
+
</details>
|
205
|
+
|
206
|
+
<details>
|
207
|
+
<summary>Parse large (Ruby 3.2, YJIT enabled)</summary>
|
208
|
+
|
209
|
+
```
|
210
|
+
Profiling IPS:
|
211
|
+
Warming up --------------------------------------
|
212
|
+
bluejay 203.000 i/100ms
|
213
|
+
graphql 30.000 i/100ms
|
214
|
+
Calculating -------------------------------------
|
215
|
+
bluejay 2.106k (± 1.4%) i/s - 10.556k in 5.014156s
|
216
|
+
graphql 308.161 (± 1.9%) i/s - 1.560k in 5.064324s
|
217
|
+
|
218
|
+
Comparison:
|
219
|
+
bluejay: 2105.7 i/s
|
220
|
+
graphql: 308.2 i/s - 6.83x slower
|
221
|
+
|
222
|
+
Profiling Ruby memory allocations:
|
223
|
+
Calculating -------------------------------------
|
224
|
+
bluejay 0.000 memsize ( 0.000 retained)
|
225
|
+
0.000 objects ( 0.000 retained)
|
226
|
+
0.000 strings ( 0.000 retained)
|
227
|
+
graphql 1.425M memsize ( 556.448k retained)
|
228
|
+
16.001k objects ( 7.541k retained)
|
229
|
+
50.000 strings ( 50.000 retained)
|
230
|
+
|
231
|
+
Comparison:
|
232
|
+
bluejay: 0 allocated
|
233
|
+
graphql: 1425400 allocated - Infx more
|
234
|
+
```
|
235
|
+
</details>
|
236
|
+
|
237
|
+
<details>
|
238
|
+
<summary>Parse large (Ruby 3.2, YJIT disabled)</summary>
|
239
|
+
|
240
|
+
```
|
241
|
+
Profiling IPS:
|
242
|
+
Warming up --------------------------------------
|
243
|
+
bluejay 208.000 i/100ms
|
244
|
+
graphql 27.000 i/100ms
|
245
|
+
Calculating -------------------------------------
|
246
|
+
bluejay 2.098k (± 1.6%) i/s - 10.608k in 5.057106s
|
247
|
+
graphql 274.835 (± 1.8%) i/s - 1.377k in 5.011880s
|
248
|
+
|
249
|
+
Comparison:
|
250
|
+
bluejay: 2098.2 i/s
|
251
|
+
graphql: 274.8 i/s - 7.63x slower
|
252
|
+
|
253
|
+
Profiling Ruby memory allocations:
|
254
|
+
Calculating -------------------------------------
|
255
|
+
bluejay 0.000 memsize ( 0.000 retained)
|
256
|
+
0.000 objects ( 0.000 retained)
|
257
|
+
0.000 strings ( 0.000 retained)
|
258
|
+
graphql 1.425M memsize ( 0.000 retained)
|
259
|
+
16.001k objects ( 0.000 retained)
|
260
|
+
50.000 strings ( 0.000 retained)
|
261
|
+
|
262
|
+
Comparison:
|
263
|
+
bluejay: 0 allocated
|
264
|
+
graphql: 1425400 allocated - Infx more
|
265
|
+
```
|
266
|
+
</details>
|
267
|
+
|
268
|
+
<details>
|
269
|
+
<summary>Parse + Validate (Ruby 3.2, YJIT enabled)</summary>
|
270
|
+
|
271
|
+
```
|
272
|
+
Profiling IPS:
|
273
|
+
Warming up --------------------------------------
|
274
|
+
graphql 504.000 i/100ms
|
275
|
+
bluejay 5.370k i/100ms
|
276
|
+
Calculating -------------------------------------
|
277
|
+
graphql 4.991k (± 6.2%) i/s - 25.200k in 5.073307s
|
278
|
+
bluejay 45.612k (±11.5%) i/s - 225.540k in 5.057627s
|
279
|
+
|
280
|
+
Comparison:
|
281
|
+
bluejay: 45612.5 i/s
|
282
|
+
graphql: 4991.1 i/s - 9.14x slower
|
283
|
+
|
284
|
+
Profiling Ruby memory allocations:
|
285
|
+
Calculating -------------------------------------
|
286
|
+
graphql 33.392k memsize ( 12.200k retained)
|
287
|
+
383.000 objects ( 152.000 retained)
|
288
|
+
17.000 strings ( 13.000 retained)
|
289
|
+
bluejay 40.000 memsize ( 40.000 retained)
|
290
|
+
1.000 objects ( 1.000 retained)
|
291
|
+
0.000 strings ( 0.000 retained)
|
292
|
+
|
293
|
+
Comparison:
|
294
|
+
bluejay: 40 allocated
|
295
|
+
graphql: 33392 allocated - 834.80x more
|
296
|
+
```
|
297
|
+
</details>
|
298
|
+
|
299
|
+
<details>
|
300
|
+
<summary>Parse + Validate (Ruby 3.2, YJIT disabled)</summary>
|
301
|
+
|
302
|
+
```
|
303
|
+
Profiling IPS:
|
304
|
+
Warming up --------------------------------------
|
305
|
+
graphql 299.000 i/100ms
|
306
|
+
bluejay 4.726k i/100ms
|
307
|
+
Calculating -------------------------------------
|
308
|
+
graphql 2.953k (± 5.0%) i/s - 14.950k in 5.075697s
|
309
|
+
bluejay 51.904k (± 4.0%) i/s - 259.930k in 5.016499s
|
310
|
+
|
311
|
+
Comparison:
|
312
|
+
bluejay: 51904.0 i/s
|
313
|
+
graphql: 2953.1 i/s - 17.58x slower
|
314
|
+
|
315
|
+
Profiling Ruby memory allocations:
|
316
|
+
Calculating -------------------------------------
|
317
|
+
graphql 33.304k memsize ( 12.320k retained)
|
318
|
+
381.000 objects ( 155.000 retained)
|
319
|
+
15.000 strings ( 13.000 retained)
|
320
|
+
bluejay 40.000 memsize ( 40.000 retained)
|
321
|
+
1.000 objects ( 1.000 retained)
|
322
|
+
0.000 strings ( 0.000 retained)
|
323
|
+
|
324
|
+
Comparison:
|
325
|
+
bluejay: 40 allocated
|
326
|
+
graphql: 33304 allocated - 832.60x more
|
327
|
+
```
|
328
|
+
</details>
|
329
|
+
|
330
|
+
<details>
|
331
|
+
<summary>Schema dump (Ruby 3.2, YJIT enabled)</summary>
|
332
|
+
|
333
|
+
```
|
334
|
+
Profiling IPS:
|
335
|
+
Warming up --------------------------------------
|
336
|
+
graphql 189.000 i/100ms
|
337
|
+
bluejay 4.228k i/100ms
|
338
|
+
Calculating -------------------------------------
|
339
|
+
graphql 1.929k (± 7.3%) i/s - 9.639k in 5.026688s
|
340
|
+
bluejay 43.632k (± 4.6%) i/s - 219.856k in 5.050598s
|
341
|
+
|
342
|
+
Comparison:
|
343
|
+
bluejay: 43631.9 i/s
|
344
|
+
graphql: 1929.2 i/s - 22.62x slower
|
345
|
+
|
346
|
+
Profiling Ruby memory allocations:
|
347
|
+
Calculating -------------------------------------
|
348
|
+
graphql 77.788k memsize ( 0.000 retained)
|
349
|
+
755.000 objects ( 0.000 retained)
|
350
|
+
50.000 strings ( 0.000 retained)
|
351
|
+
bluejay 699.000 memsize ( 0.000 retained)
|
352
|
+
1.000 objects ( 0.000 retained)
|
353
|
+
1.000 strings ( 0.000 retained)
|
354
|
+
|
355
|
+
Comparison:
|
356
|
+
bluejay: 699 allocated
|
357
|
+
graphql: 77788 allocated - 111.28x more
|
358
|
+
```
|
359
|
+
</details>
|
360
|
+
|
361
|
+
<details>
|
362
|
+
<summary>Schema dump (Ruby 3.2, YJIT disabled)</summary>
|
363
|
+
|
364
|
+
```
|
365
|
+
Profiling IPS:
|
366
|
+
Warming up --------------------------------------
|
367
|
+
graphql 157.000 i/100ms
|
368
|
+
bluejay 4.662k i/100ms
|
369
|
+
Calculating -------------------------------------
|
370
|
+
graphql 1.562k (± 1.7%) i/s - 7.850k in 5.027157s
|
371
|
+
bluejay 45.335k (± 3.3%) i/s - 228.438k in 5.044407s
|
372
|
+
|
373
|
+
Comparison:
|
374
|
+
bluejay: 45335.1 i/s
|
375
|
+
graphql: 1561.9 i/s - 29.02x slower
|
376
|
+
|
377
|
+
Profiling Ruby memory allocations:
|
378
|
+
Calculating -------------------------------------
|
379
|
+
graphql 77.884k memsize ( 675.000 retained)
|
380
|
+
755.000 objects ( 10.000 retained)
|
381
|
+
50.000 strings ( 7.000 retained)
|
382
|
+
bluejay 699.000 memsize ( 0.000 retained)
|
383
|
+
1.000 objects ( 0.000 retained)
|
384
|
+
1.000 strings ( 0.000 retained)
|
385
|
+
|
386
|
+
Comparison:
|
387
|
+
bluejay: 699 allocated
|
388
|
+
graphql: 77884 allocated - 111.42x more
|
389
|
+
```
|
390
|
+
</details>
|
391
|
+
<!---benchmark result end-->
|
392
|
+
|
393
|
+
## Installation
|
394
|
+
|
395
|
+
Install the gem and add to the application's Gemfile by executing:
|
396
|
+
|
397
|
+
$ bundle add bluejay
|
398
|
+
|
399
|
+
If bundler is not being used to manage dependencies, install the gem by executing:
|
400
|
+
|
401
|
+
$ gem install bluejay
|
402
|
+
|
403
|
+
## Usage
|
404
|
+
|
405
|
+
See an example in the [`/example`](/example) directory. Note the usage of [Tapioca](https://github.com/Shopify/tapioca) RBI generation for the DSL at [`/example/sorbet/rbi/dsl/graph`](/example/sorbet/rbi/dsl/graph)
|
406
|
+
|
407
|
+
## Development
|
408
|
+
|
409
|
+
After checking out the repo, run `bin/setup` to install dependencies and `rake compile` to compile the Rust extension. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
410
|
+
|
411
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
Binary file
|
Binary file
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# typed: strict
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Bluejay
|
5
|
+
module Base
|
6
|
+
module CustomScalarType
|
7
|
+
extend(T::Sig)
|
8
|
+
extend(T::Helpers)
|
9
|
+
|
10
|
+
interface!
|
11
|
+
|
12
|
+
module ClassMethods
|
13
|
+
extend(T::Sig)
|
14
|
+
extend(T::Helpers)
|
15
|
+
|
16
|
+
abstract!
|
17
|
+
|
18
|
+
sig { abstract.returns(CustomScalarTypeDefinition) }
|
19
|
+
def definition; end
|
20
|
+
end
|
21
|
+
|
22
|
+
mixes_in_class_methods(ClassMethods)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# typed: strict
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Bluejay
|
5
|
+
module Base
|
6
|
+
module Directive
|
7
|
+
extend(T::Sig)
|
8
|
+
extend(T::Helpers)
|
9
|
+
|
10
|
+
interface!
|
11
|
+
|
12
|
+
module ClassMethods
|
13
|
+
extend(T::Sig)
|
14
|
+
extend(T::Helpers)
|
15
|
+
|
16
|
+
abstract!
|
17
|
+
|
18
|
+
sig { abstract.returns(DirectiveDefinition) }
|
19
|
+
def definition; end
|
20
|
+
end
|
21
|
+
|
22
|
+
mixes_in_class_methods(ClassMethods)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# typed: strict
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Bluejay
|
5
|
+
module Base
|
6
|
+
module EnumType
|
7
|
+
extend(T::Sig)
|
8
|
+
extend(T::Helpers)
|
9
|
+
|
10
|
+
interface!
|
11
|
+
|
12
|
+
module ClassMethods
|
13
|
+
extend(T::Sig)
|
14
|
+
extend(T::Helpers)
|
15
|
+
|
16
|
+
abstract!
|
17
|
+
|
18
|
+
sig { abstract.returns(EnumTypeDefinition) }
|
19
|
+
def definition; end
|
20
|
+
end
|
21
|
+
|
22
|
+
mixes_in_class_methods(ClassMethods)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# typed: strict
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Bluejay
|
5
|
+
module Base
|
6
|
+
module InputObjectType
|
7
|
+
extend(T::Sig)
|
8
|
+
extend(T::Helpers)
|
9
|
+
|
10
|
+
interface!
|
11
|
+
|
12
|
+
module ClassMethods
|
13
|
+
extend(T::Sig)
|
14
|
+
extend(T::Helpers)
|
15
|
+
|
16
|
+
abstract!
|
17
|
+
|
18
|
+
sig { abstract.returns(InputObjectTypeDefinition) }
|
19
|
+
def definition; end
|
20
|
+
end
|
21
|
+
|
22
|
+
mixes_in_class_methods(ClassMethods)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# typed: strict
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Bluejay
|
5
|
+
module Base
|
6
|
+
module InterfaceType
|
7
|
+
extend(T::Sig)
|
8
|
+
extend(T::Helpers)
|
9
|
+
|
10
|
+
interface!
|
11
|
+
|
12
|
+
module ClassMethods
|
13
|
+
extend(T::Sig)
|
14
|
+
extend(T::Helpers)
|
15
|
+
|
16
|
+
abstract!
|
17
|
+
|
18
|
+
sig { abstract.returns(InterfaceTypeDefinition) }
|
19
|
+
def definition; end
|
20
|
+
end
|
21
|
+
|
22
|
+
mixes_in_class_methods(ClassMethods)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# typed: strict
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Bluejay
|
5
|
+
module Base
|
6
|
+
module ObjectType
|
7
|
+
extend(T::Sig)
|
8
|
+
extend(T::Helpers)
|
9
|
+
|
10
|
+
interface!
|
11
|
+
|
12
|
+
module ClassMethods
|
13
|
+
extend(T::Sig)
|
14
|
+
extend(T::Helpers)
|
15
|
+
|
16
|
+
abstract!
|
17
|
+
|
18
|
+
sig { abstract.returns(ObjectTypeDefinition) }
|
19
|
+
def definition; end
|
20
|
+
end
|
21
|
+
|
22
|
+
mixes_in_class_methods(ClassMethods)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# typed: strict
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Bluejay
|
5
|
+
module Base
|
6
|
+
module QueryRoot
|
7
|
+
extend(T::Sig)
|
8
|
+
extend(T::Helpers)
|
9
|
+
|
10
|
+
requires_ancestor { ObjectType }
|
11
|
+
interface!
|
12
|
+
|
13
|
+
module ClassMethods
|
14
|
+
extend(T::Sig)
|
15
|
+
extend(T::Helpers)
|
16
|
+
|
17
|
+
abstract!
|
18
|
+
|
19
|
+
requires_ancestor { ObjectType::ClassMethods }
|
20
|
+
end
|
21
|
+
|
22
|
+
mixes_in_class_methods(ClassMethods)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# typed: strict
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Bluejay
|
5
|
+
module Base
|
6
|
+
module Schema
|
7
|
+
extend(T::Sig)
|
8
|
+
extend(T::Helpers)
|
9
|
+
|
10
|
+
interface!
|
11
|
+
|
12
|
+
module ClassMethods
|
13
|
+
extend(T::Sig)
|
14
|
+
extend(T::Helpers)
|
15
|
+
|
16
|
+
abstract!
|
17
|
+
|
18
|
+
sig { abstract.returns(SchemaDefinition) }
|
19
|
+
def definition; end
|
20
|
+
end
|
21
|
+
|
22
|
+
mixes_in_class_methods(ClassMethods)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# typed: strict
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Bluejay
|
5
|
+
module Base
|
6
|
+
module UnionType
|
7
|
+
extend(T::Sig)
|
8
|
+
extend(T::Helpers)
|
9
|
+
|
10
|
+
interface!
|
11
|
+
|
12
|
+
module ClassMethods
|
13
|
+
extend(T::Sig)
|
14
|
+
extend(T::Helpers)
|
15
|
+
|
16
|
+
abstract!
|
17
|
+
|
18
|
+
sig { abstract.returns(UnionTypeDefinition) }
|
19
|
+
def definition; end
|
20
|
+
end
|
21
|
+
|
22
|
+
mixes_in_class_methods(ClassMethods)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/lib/bluejay/base.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "base/custom_scalar_type"
|
4
|
+
require_relative "base/directive"
|
5
|
+
require_relative "base/enum_type"
|
6
|
+
require_relative "base/input_object_type"
|
7
|
+
require_relative "base/interface_type"
|
8
|
+
require_relative "base/object_type"
|
9
|
+
require_relative "base/query_root"
|
10
|
+
require_relative "base/schema"
|
11
|
+
require_relative "base/union_type"
|