Skip to content

Commit 7f66620

Browse files
committed
add ruby 3.4 CI, ref
1 parent fb68e72 commit 7f66620

File tree

6 files changed

+257
-127
lines changed

6 files changed

+257
-127
lines changed

.github/workflows/main.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,14 @@ jobs:
1414
strategy:
1515
matrix:
1616
ruby:
17-
- '3.0.2'
18-
- '3.2.2'
17+
- '3.0.7'
18+
- '3.2.9'
19+
- '3.4.5'
1920
- '2.7.8'
2021
- '2.3.8'
2122
- '2.5.9'
2223
env:
23-
BUNDLE_GEMFILE: ${{ (matrix.ruby >= '2.7' && 'Gemfile') || (matrix.ruby >= '2.5' && 'Gemfile_ruby_2_5') || 'Gemfile_ruby_2_3' }}
24+
BUNDLE_GEMFILE: ${{ (matrix.ruby >= '3.4' && 'Gemfile_ruby_3_4') || (matrix.ruby >= '2.7' && 'Gemfile') || (matrix.ruby >= '2.5' && 'Gemfile_ruby_2_5') || 'Gemfile_ruby_2_3' }}
2425

2526
steps:
2627
- name: Dependencies

Gemfile_ruby_3_4

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Gemfile

Gemfile_ruby_3_4.lock

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
PATH
2+
remote: .
3+
specs:
4+
json_scanner (0.3.1)
5+
json
6+
7+
GEM
8+
remote: https://rubygems.org/
9+
specs:
10+
activesupport (7.1.5.2)
11+
base64
12+
benchmark (>= 0.3)
13+
bigdecimal
14+
concurrent-ruby (~> 1.0, >= 1.0.2)
15+
connection_pool (>= 2.2.5)
16+
drb
17+
i18n (>= 1.6, < 2)
18+
logger (>= 1.4.2)
19+
minitest (>= 5.1)
20+
mutex_m
21+
securerandom (>= 0.3)
22+
tzinfo (~> 2.0)
23+
ast (2.4.2)
24+
base64 (0.3.0)
25+
benchmark (0.4.1)
26+
benchmark-ips (2.14.0)
27+
benchmark-memory (0.2.0)
28+
memory_profiler (~> 1)
29+
bigdecimal (3.2.2)
30+
concurrent-ruby (1.3.5)
31+
connection_pool (2.5.3)
32+
diff-lcs (1.5.1)
33+
drb (2.2.3)
34+
i18n (1.14.7)
35+
concurrent-ruby (~> 1.0)
36+
json (2.13.2)
37+
json-next (1.2.1)
38+
language_server-protocol (3.17.0.3)
39+
logger (1.7.0)
40+
memory_profiler (1.0.2)
41+
minitest (5.25.5)
42+
mutex_m (0.3.0)
43+
nokogiri (1.18.9-arm64-darwin)
44+
racc (~> 1.4)
45+
nokogiri (1.18.9-x86_64-linux-gnu)
46+
racc (~> 1.4)
47+
oj (3.16.11)
48+
bigdecimal (>= 3.0)
49+
ostruct (>= 0.2)
50+
ostruct (0.6.3)
51+
parallel (1.26.3)
52+
parser (3.3.6.0)
53+
ast (~> 2.4.1)
54+
racc
55+
parslet (2.0.0)
56+
racc (1.8.1)
57+
rainbow (3.1.1)
58+
rake (13.2.1)
59+
rake-compiler (1.2.8)
60+
rake
61+
rb_json5 (0.3.0)
62+
parslet (~> 2.0)
63+
regexp_parser (2.9.3)
64+
rspec (3.13.0)
65+
rspec-core (~> 3.13.0)
66+
rspec-expectations (~> 3.13.0)
67+
rspec-mocks (~> 3.13.0)
68+
rspec-core (3.13.2)
69+
rspec-support (~> 3.13.0)
70+
rspec-expectations (3.13.3)
71+
diff-lcs (>= 1.2.0, < 2.0)
72+
rspec-support (~> 3.13.0)
73+
rspec-mocks (3.13.2)
74+
diff-lcs (>= 1.2.0, < 2.0)
75+
rspec-support (~> 3.13.0)
76+
rspec-support (3.13.2)
77+
rubocop (1.69.1)
78+
json (~> 2.3)
79+
language_server-protocol (>= 3.17.0)
80+
parallel (~> 1.10)
81+
parser (>= 3.3.0.2)
82+
rainbow (>= 2.2.2, < 4.0)
83+
regexp_parser (>= 2.9.3, < 3.0)
84+
rubocop-ast (>= 1.36.2, < 2.0)
85+
ruby-progressbar (~> 1.7)
86+
unicode-display_width (>= 2.4.0, < 4.0)
87+
rubocop-ast (1.36.2)
88+
parser (>= 3.3.1.0)
89+
rubocop-rspec (3.3.0)
90+
rubocop (~> 1.61)
91+
ruby-progressbar (1.13.0)
92+
ruby_memcheck (2.3.0)
93+
nokogiri
94+
securerandom (0.3.2)
95+
tzinfo (2.0.6)
96+
concurrent-ruby (~> 1.0)
97+
unicode-display_width (3.1.2)
98+
unicode-emoji (~> 4.0, >= 4.0.4)
99+
unicode-emoji (4.0.4)
100+
101+
PLATFORMS
102+
arm64-darwin-23
103+
x86_64-linux
104+
105+
DEPENDENCIES
106+
activesupport (~> 7.1)
107+
benchmark (~> 0.4.1)
108+
benchmark-ips (~> 2.14)
109+
benchmark-memory (~> 0.2.0)
110+
json (~> 2.13)
111+
json-next (~> 1.2)
112+
json_scanner!
113+
oj (~> 3.16)
114+
rainbow (~> 3.1)
115+
rake (~> 13.0)
116+
rake-compiler (~> 1.2)
117+
rb_json5 (~> 0.3.0)
118+
rspec (~> 3.0)
119+
rubocop (~> 1.69)
120+
rubocop-rspec (~> 3.3)
121+
ruby_memcheck (~> 2.3)
122+
123+
BUNDLED WITH
124+
2.4.20

README.md

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,3 +192,130 @@ Bug reports and pull requests are welcome on GitHub at [github](https://github.c
192192
## License
193193

194194
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
195+
196+
## Benchmarks
197+
198+
```shell
199+
========= JSON string size: 463 KB =========
200+
path :data, :search, :searchResult, :paginationV2, :maxPage; extracted values: [8, 8, 8, 8]
201+
ruby 2.7.8p225 (2023-03-30 revision 1f4d455848) [x86_64-linux]
202+
Warming up --------------------------------------
203+
json 9.000 i/100ms
204+
oj 18.000 i/100ms
205+
json_scanner scan 70.000 i/100ms
206+
json_scanner parse 74.000 i/100ms
207+
Calculating -------------------------------------
208+
json 93.566 (± 2.1%) i/s (10.69 ms/i) - 468.000 in 5.004734s
209+
oj 188.098 (± 5.3%) i/s (5.32 ms/i) - 954.000 in 5.088179s
210+
json_scanner scan 740.777 (± 3.1%) i/s (1.35 ms/i) - 3.710k in 5.013415s
211+
json_scanner parse 738.147 (± 2.2%) i/s (1.35 ms/i) - 3.700k in 5.014863s
212+
213+
Comparison:
214+
json_scanner scan: 740.8 i/s
215+
json_scanner parse: 738.1 i/s - same-ish: difference falls within error
216+
oj: 188.1 i/s - 3.94x slower
217+
json: 93.6 i/s - 7.92x slower
218+
219+
Calculating -------------------------------------
220+
json 1.987M memsize ( 0.000 retained)
221+
26.302k objects ( 0.000 retained)
222+
50.000 strings ( 0.000 retained)
223+
oj 1.379M memsize ( 0.000 retained)
224+
9.665k objects ( 0.000 retained)
225+
50.000 strings ( 0.000 retained)
226+
json_scanner scan 368.000 memsize ( 0.000 retained)
227+
6.000 objects ( 0.000 retained)
228+
1.000 strings ( 0.000 retained)
229+
json_scanner parse 2.240k memsize ( 528.000 retained)
230+
23.000 objects ( 9.000 retained)
231+
1.000 strings ( 0.000 retained)
232+
233+
Comparison:
234+
json_scanner scan: 368 allocated
235+
json_scanner parse: 2240 allocated - 6.09x more
236+
oj: 1379274 allocated - 3748.03x more
237+
json: 1987269 allocated - 5400.19x more
238+
============================================
239+
240+
========= JSON string size: 463 KB =========
241+
path :data, :search, :searchResult, :paginationV2, :maxPage; extracted values: [8, 8, 8, 8]
242+
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-linux]
243+
Warming up --------------------------------------
244+
json 15.000 i/100ms
245+
oj 17.000 i/100ms
246+
json_scanner scan 74.000 i/100ms
247+
json_scanner parse 73.000 i/100ms
248+
Calculating -------------------------------------
249+
json 156.015 (± 4.5%) i/s (6.41 ms/i) - 780.000 in 5.009398s
250+
oj 146.395 (±19.1%) i/s (6.83 ms/i) - 714.000 in 5.085658s
251+
json_scanner scan 513.451 (±29.4%) i/s (1.95 ms/i) - 2.368k in 5.046488s
252+
json_scanner parse 640.176 (±16.2%) i/s (1.56 ms/i) - 3.139k in 5.067958s
253+
254+
Comparison:
255+
json_scanner parse: 640.2 i/s
256+
json_scanner scan: 513.5 i/s - same-ish: difference falls within error
257+
json: 156.0 i/s - 4.10x slower
258+
oj: 146.4 i/s - 4.37x slower
259+
260+
Calculating -------------------------------------
261+
json 1.402M memsize ( 0.000 retained)
262+
10.184k objects ( 0.000 retained)
263+
50.000 strings ( 0.000 retained)
264+
oj 1.441M memsize ( 168.000 retained)
265+
9.665k objects ( 1.000 retained)
266+
50.000 strings ( 0.000 retained)
267+
json_scanner scan 368.000 memsize ( 0.000 retained)
268+
6.000 objects ( 0.000 retained)
269+
1.000 strings ( 0.000 retained)
270+
json_scanner parse 2.072k memsize ( 360.000 retained)
271+
22.000 objects ( 8.000 retained)
272+
1.000 strings ( 0.000 retained)
273+
274+
Comparison:
275+
json_scanner scan: 368 allocated
276+
json_scanner parse: 2072 allocated - 5.63x more
277+
json: 1401815 allocated - 3809.28x more
278+
oj: 1440774 allocated - 3915.15x more
279+
============================================
280+
281+
========= JSON string size: 463 KB =========
282+
path :data, :search, :searchResult, :paginationV2, :maxPage; extracted values: [8, 8, 8, 8]
283+
ruby 3.4.2 (2025-02-15 revision d2930f8e7a) +PRISM [x86_64-linux]
284+
Warming up --------------------------------------
285+
json 11.000 i/100ms
286+
oj 12.000 i/100ms
287+
json_scanner scan 68.000 i/100ms
288+
json_scanner parse 75.000 i/100ms
289+
Calculating -------------------------------------
290+
json 153.145 (± 9.1%) i/s (6.53 ms/i) - 759.000 in 5.003997s
291+
oj 161.947 (± 3.7%) i/s (6.17 ms/i) - 816.000 in 5.045710s
292+
json_scanner scan 733.917 (± 1.9%) i/s (1.36 ms/i) - 3.672k in 5.005395s
293+
json_scanner parse 719.953 (± 2.1%) i/s (1.39 ms/i) - 3.600k in 5.002508s
294+
295+
Comparison:
296+
json_scanner scan: 733.9 i/s
297+
json_scanner parse: 720.0 i/s - same-ish: difference falls within error
298+
oj: 161.9 i/s - 4.53x slower
299+
json: 153.1 i/s - 4.79x slower
300+
301+
Calculating -------------------------------------
302+
json 1.377M memsize ( 0.000 retained)
303+
10.184k objects ( 0.000 retained)
304+
50.000 strings ( 0.000 retained)
305+
oj 1.363M memsize ( 0.000 retained)
306+
9.665k objects ( 0.000 retained)
307+
50.000 strings ( 0.000 retained)
308+
json_scanner scan 360.000 memsize ( 0.000 retained)
309+
6.000 objects ( 0.000 retained)
310+
1.000 strings ( 0.000 retained)
311+
json_scanner parse 2.000k memsize ( 360.000 retained)
312+
22.000 objects ( 8.000 retained)
313+
1.000 strings ( 0.000 retained)
314+
315+
Comparison:
316+
json_scanner scan: 360 allocated
317+
json_scanner parse: 2000 allocated - 5.56x more
318+
oj: 1363382 allocated - 3787.17x more
319+
json: 1376519 allocated - 3823.66x more
320+
============================================
321+
```

0 commit comments

Comments
 (0)