oj 3.7.12 → 3.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -2
- data/ext/oj/custom.c +15 -12
- data/ext/oj/dump.c +46 -26
- data/ext/oj/dump.h +2 -0
- data/ext/oj/dump_compat.c +13 -9
- data/ext/oj/mimic_json.c +7 -2
- data/ext/oj/oj.c +34 -24
- data/ext/oj/oj.h +6 -2
- data/ext/oj/parse.c +2 -1
- data/ext/oj/rails.c +8 -0
- data/ext/oj/sparse.c +2 -2
- data/ext/oj/string_writer.c +25 -3
- data/lib/oj/json.rb +1 -1
- data/lib/oj/version.rb +1 -1
- data/pages/Modes.md +3 -2
- data/pages/Options.md +19 -2
- data/pages/Security.md +1 -1
- data/test/bar.rb +25 -0
- data/test/foo.rb +160 -26
- data/test/test_custom.rb +99 -2
- data/test/test_various.rb +2 -0
- data/test/zoo.rb +13 -0
- metadata +71 -71
- data/test/big.rb +0 -15
- data/test/mem.rb +0 -35
data/test/test_various.rb
CHANGED
@@ -134,6 +134,7 @@ class Juice < Minitest::Test
|
|
134
134
|
:use_to_json=>false,
|
135
135
|
:use_to_hash=>false,
|
136
136
|
:use_as_json=>false,
|
137
|
+
:use_raw_json=>false,
|
137
138
|
:nilnil=>true,
|
138
139
|
:empty_string=>true,
|
139
140
|
:allow_gc=>false,
|
@@ -158,6 +159,7 @@ class Juice < Minitest::Test
|
|
158
159
|
:array_class=>Array,
|
159
160
|
:ignore=>nil,
|
160
161
|
:trace=>true,
|
162
|
+
:safe=>true,
|
161
163
|
}
|
162
164
|
Oj.default_options = alt
|
163
165
|
#keys = alt.keys
|
data/test/zoo.rb
ADDED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oj
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Ohler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake-compiler
|
@@ -79,16 +79,16 @@ extensions:
|
|
79
79
|
- ext/oj/extconf.rb
|
80
80
|
extra_rdoc_files:
|
81
81
|
- README.md
|
82
|
-
- pages/
|
82
|
+
- pages/Rails.md
|
83
|
+
- pages/JsonGem.md
|
84
|
+
- pages/Encoding.md
|
85
|
+
- pages/WAB.md
|
86
|
+
- pages/Custom.md
|
83
87
|
- pages/Advanced.md
|
84
88
|
- pages/Options.md
|
85
|
-
- pages/Custom.md
|
86
89
|
- pages/Compatibility.md
|
87
|
-
- pages/
|
90
|
+
- pages/Modes.md
|
88
91
|
- pages/Security.md
|
89
|
-
- pages/Encoding.md
|
90
|
-
- pages/JsonGem.md
|
91
|
-
- pages/Rails.md
|
92
92
|
files:
|
93
93
|
- LICENSE
|
94
94
|
- README.md
|
@@ -177,7 +177,7 @@ files:
|
|
177
177
|
- test/activesupport5/encoding_test_cases.rb
|
178
178
|
- test/activesupport5/test_helper.rb
|
179
179
|
- test/activesupport5/time_zone_test_helpers.rb
|
180
|
-
- test/
|
180
|
+
- test/bar.rb
|
181
181
|
- test/files.rb
|
182
182
|
- test/foo.rb
|
183
183
|
- test/helper.rb
|
@@ -200,7 +200,6 @@ files:
|
|
200
200
|
- test/json_gem/json_parser_test.rb
|
201
201
|
- test/json_gem/json_string_matching_test.rb
|
202
202
|
- test/json_gem/test_helper.rb
|
203
|
-
- test/mem.rb
|
204
203
|
- test/perf.rb
|
205
204
|
- test/perf_compat.rb
|
206
205
|
- test/perf_fast.rb
|
@@ -244,6 +243,7 @@ files:
|
|
244
243
|
- test/tests.rb
|
245
244
|
- test/tests_mimic.rb
|
246
245
|
- test/tests_mimic_addition.rb
|
246
|
+
- test/zoo.rb
|
247
247
|
homepage: http://www.ohler.com/oj
|
248
248
|
licenses:
|
249
249
|
- MIT
|
@@ -266,7 +266,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
266
266
|
requirements:
|
267
267
|
- - ">="
|
268
268
|
- !ruby/object:Gem::Version
|
269
|
-
version: '2.
|
269
|
+
version: '2.3'
|
270
270
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
271
271
|
requirements:
|
272
272
|
- - ">="
|
@@ -278,82 +278,82 @@ signing_key:
|
|
278
278
|
specification_version: 4
|
279
279
|
summary: A fast JSON parser and serializer.
|
280
280
|
test_files:
|
281
|
-
- test/
|
282
|
-
- test/test_hash.rb
|
283
|
-
- test/perf.rb
|
284
|
-
- test/test_object.rb
|
285
|
-
- test/test_null.rb
|
286
|
-
- test/test_compat.rb
|
287
|
-
- test/test_custom.rb
|
288
|
-
- test/perf_scp.rb
|
281
|
+
- test/foo.rb
|
289
282
|
- test/test_integer_range.rb
|
290
|
-
- test/
|
291
|
-
- test/
|
292
|
-
- test/
|
283
|
+
- test/test_strict.rb
|
284
|
+
- test/perf_strict.rb
|
285
|
+
- test/tests.rb
|
286
|
+
- test/perf_saj.rb
|
287
|
+
- test/test_compat.rb
|
288
|
+
- test/helper.rb
|
289
|
+
- test/perf_file.rb
|
290
|
+
- test/test_scp.rb
|
291
|
+
- test/perf_compat.rb
|
292
|
+
- test/json_gem/json_common_interface_test.rb
|
293
293
|
- test/json_gem/json_addition_test.rb
|
294
|
-
- test/json_gem/
|
294
|
+
- test/json_gem/json_fixtures_test.rb
|
295
|
+
- test/json_gem/json_ext_parser_test.rb
|
296
|
+
- test/json_gem/json_string_matching_test.rb
|
297
|
+
- test/json_gem/json_generic_object_test.rb
|
295
298
|
- test/json_gem/json_generator_test.rb
|
296
|
-
- test/json_gem/
|
299
|
+
- test/json_gem/test_helper.rb
|
297
300
|
- test/json_gem/json_encoding_test.rb
|
298
|
-
- test/json_gem/
|
299
|
-
- test/
|
300
|
-
- test/
|
301
|
-
- test/
|
302
|
-
- test/
|
303
|
-
- test/
|
301
|
+
- test/json_gem/json_parser_test.rb
|
302
|
+
- test/perf_wab.rb
|
303
|
+
- test/test_file.rb
|
304
|
+
- test/test_object.rb
|
305
|
+
- test/sample.rb
|
306
|
+
- test/perf_object.rb
|
307
|
+
- test/test_hash.rb
|
308
|
+
- test/test_custom.rb
|
309
|
+
- test/bar.rb
|
310
|
+
- test/activesupport4/encoding_test.rb
|
304
311
|
- test/activesupport4/test_helper.rb
|
305
312
|
- test/activesupport4/decoding_test.rb
|
306
|
-
- test/
|
307
|
-
- test/activerecord/result_test.rb
|
308
|
-
- test/_test_active.rb
|
309
|
-
- test/test_file.rb
|
313
|
+
- test/sample_json.rb
|
310
314
|
- test/activesupport5/encoding_test_cases.rb
|
315
|
+
- test/activesupport5/encoding_test.rb
|
311
316
|
- test/activesupport5/time_zone_test_helpers.rb
|
312
317
|
- test/activesupport5/test_helper.rb
|
313
318
|
- test/activesupport5/decoding_test.rb
|
314
|
-
- test/activesupport5/encoding_test.rb
|
315
|
-
- test/tests.rb
|
316
|
-
- test/_test_active_mimic.rb
|
317
|
-
- test/perf_object.rb
|
318
|
-
- test/test_strict.rb
|
319
|
-
- test/test_scp.rb
|
320
|
-
- test/perf_wab.rb
|
321
319
|
- test/test_saj.rb
|
322
|
-
- test/
|
323
|
-
- test/
|
324
|
-
- test/
|
325
|
-
- test/
|
326
|
-
- test/
|
327
|
-
- test/isolated/test_mimic_rails_after.rb
|
328
|
-
- test/isolated/test_mimic_after.rb
|
329
|
-
- test/isolated/test_mimic_rails_before.rb
|
330
|
-
- test/isolated/test_mimic_as_json.rb
|
331
|
-
- test/isolated/test_mimic_redefine.rb
|
332
|
-
- test/isolated/shared.rb
|
333
|
-
- test/isolated/test_mimic_before.rb
|
334
|
-
- test/sample_json.rb
|
335
|
-
- test/test_debian.rb
|
336
|
-
- test/perf_fast.rb
|
337
|
-
- test/test_writer.rb
|
320
|
+
- test/perf_scp.rb
|
321
|
+
- test/test_wab.rb
|
322
|
+
- test/test_null.rb
|
323
|
+
- test/_test_active.rb
|
324
|
+
- test/_test_mimic_rails.rb
|
338
325
|
- test/test_fast.rb
|
339
|
-
- test/
|
326
|
+
- test/perf_fast.rb
|
340
327
|
- test/sample/change.rb
|
341
|
-
- test/sample/dir.rb
|
342
328
|
- test/sample/text.rb
|
343
|
-
- test/sample/layer.rb
|
344
|
-
- test/sample/rect.rb
|
345
|
-
- test/sample/group.rb
|
346
|
-
- test/sample/oval.rb
|
347
329
|
- test/sample/doc.rb
|
348
|
-
- test/sample/hasprops.rb
|
349
330
|
- test/sample/shape.rb
|
331
|
+
- test/sample/layer.rb
|
332
|
+
- test/sample/group.rb
|
350
333
|
- test/sample/file.rb
|
351
|
-
- test/
|
352
|
-
- test/
|
353
|
-
- test/
|
354
|
-
- test/
|
334
|
+
- test/sample/rect.rb
|
335
|
+
- test/sample/hasprops.rb
|
336
|
+
- test/sample/line.rb
|
337
|
+
- test/sample/dir.rb
|
338
|
+
- test/sample/oval.rb
|
355
339
|
- test/tests_mimic.rb
|
356
|
-
- test/perf_strict.rb
|
357
|
-
- test/test_various.rb
|
358
|
-
- test/_test_mimic_rails.rb
|
359
340
|
- test/perf_simple.rb
|
341
|
+
- test/zoo.rb
|
342
|
+
- test/activerecord/result_test.rb
|
343
|
+
- test/_test_active_mimic.rb
|
344
|
+
- test/tests_mimic_addition.rb
|
345
|
+
- test/test_writer.rb
|
346
|
+
- test/perf.rb
|
347
|
+
- test/isolated/test_mimic_define.rb
|
348
|
+
- test/isolated/test_mimic_after.rb
|
349
|
+
- test/isolated/test_mimic_rails_after.rb
|
350
|
+
- test/isolated/test_mimic_before.rb
|
351
|
+
- test/isolated/test_mimic_rails_before.rb
|
352
|
+
- test/isolated/test_mimic_redefine.rb
|
353
|
+
- test/isolated/shared.rb
|
354
|
+
- test/isolated/test_mimic_alone.rb
|
355
|
+
- test/isolated/test_mimic_as_json.rb
|
356
|
+
- test/test_debian.rb
|
357
|
+
- test/test_gc.rb
|
358
|
+
- test/files.rb
|
359
|
+
- test/test_various.rb
|
data/test/big.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
#require 'active_support'
|
2
|
-
#require 'active_support/core_ext'
|
3
|
-
#require 'active_support/json'
|
4
|
-
require 'oj'
|
5
|
-
|
6
|
-
#Oj.optimize_rails
|
7
|
-
Oj.mimic_JSON
|
8
|
-
|
9
|
-
h = {:type=>:record, :name=>:group, :namespace=>"com.salsify.identity", :fields=>[{:name=>"id", :type=>{:name=>:salsify_uuid, :type=>:fixed, :namespace=>"com.salsify", :size=>38}}, {:name=>"type", :type=>"string", :default=>"groups"}, {:name=>"external_id", :type=>[:null, "string"], :default=>nil}, {:name=>"created_at", :type=>{:type=>"long", :logicalType=>"timestamp-micros"}}, {:name=>"updated_at", :type=>{:type=>"long", :logicalType=>"timestamp-micros"}}, {:name=>"name", :type=>"string"}, {:name=>"policy", :type=>[:null, {:type=>:record, :name=>:policy, :namespace=>"com.salsify.security", :fields=>[{:name=>"created_at", :type=>{:type=>"long", :logicalType=>"timestamp-micros"}}, {:name=>"updated_at", :type=>{:type=>"long", :logicalType=>"timestamp-micros"}}, {:name=>"id", :type=>"com.salsify.salsify_uuid"}, {:name=>"type", :type=>"string", :default=>"policies"}, {:name=>"external_id", :type=>[:null, "string"], :default=>nil}, {:name=>"name", :type=>"string"}, {:name=>"statements", :type=>{:type=>:array, :items=>{:type=>:record, :name=>:statement, :namespace=>"com.salsify.security", :fields=>[{:name=>"created_at", :type=>{:type=>"long", :logicalType=>"timestamp-micros"}}, {:name=>"updated_at", :type=>{:type=>"long", :logicalType=>"timestamp-micros"}}, {:name=>"id", :type=>"com.salsify.salsify_uuid"}, {:name=>"type", :type=>"string", :default=>"statements"}, {:name=>"external_id", :type=>[:null, "string"], :default=>nil}, {:name=>"action", :type=>{:name=>"__statement_action_enum", :type=>:enum, :namespace=>"com.salsify.security", :symbols=>[:manage, :read]}}, {:name=>"resource", :type=>{:name=>"__statement_resource_enum", :type=>:enum, :namespace=>"com.salsify.security", :symbols=>[:product, :digital_asset]}}, {:name=>"conditions", :type=>{:type=>:array, :items=>{:type=>:record, :name=>:condition, :namespace=>"com.salsify.security", :fields=>[{:name=>"created_at", :type=>{:type=>"long", :logicalType=>"timestamp-micros"}}, {:name=>"updated_at", :type=>{:type=>"long", :logicalType=>"timestamp-micros"}}, {:name=>"id", :type=>"com.salsify.salsify_uuid"}, {:name=>"type", :type=>"string", :default=>"conditions"}, {:name=>"external_id", :type=>[:null, "string"], :default=>nil}, {:name=>"operator", :type=>{:name=>"__condition_operator_enum", :type=>:enum, :namespace=>"com.salsify.security", :symbols=>[:equals]}}, {:name=>"attribute_type", :type=>{:name=>"__condition_attribute_type_enum", :type=>:enum, :namespace=>"com.salsify.security", :symbols=>[:resource]}}, {:name=>"value", :type=>"string"}, {:name=>"attribute", :type=>[:null, {:type=>:record, :name=>:reference, :namespace=>"com.salsify", :fields=>[{:name=>"id", :type=>"com.salsify.salsify_uuid"}, {:name=>"type", :type=>"string", :doc=>"snake_case, plural name for the resource type"}, {:name=>"external_id", :type=>[:null, "string"], :default=>nil}]}], :default=>nil}, {:name=>"broken", :type=>[:null, "boolean"], :default=>nil}]}}}]}}}]}], :default=>nil}]}
|
10
|
-
|
11
|
-
#Oj.dump(h)
|
12
|
-
puts JSON.pretty_generate(h)
|
13
|
-
#puts JSON.fast_generate(h)
|
14
|
-
#puts JSON.generate(h)
|
15
|
-
|
data/test/mem.rb
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
$: << '.'
|
4
|
-
$: << '../lib'
|
5
|
-
$: << '../ext'
|
6
|
-
|
7
|
-
require 'objspace'
|
8
|
-
require 'oj'
|
9
|
-
require 'json'
|
10
|
-
require 'get_process_mem'
|
11
|
-
|
12
|
-
def record_allocation
|
13
|
-
GC.start
|
14
|
-
GC.start
|
15
|
-
|
16
|
-
mem = GetProcessMem.new
|
17
|
-
puts "Before - Process Memory: #{mem.mb} mb"
|
18
|
-
puts "Before - Objects count: #{ObjectSpace.each_object.count}"
|
19
|
-
puts "Before - Symbols count: #{Symbol.all_symbols.size}"
|
20
|
-
|
21
|
-
yield
|
22
|
-
|
23
|
-
GC.start
|
24
|
-
GC.start
|
25
|
-
GC.start
|
26
|
-
|
27
|
-
puts "After - Process Memory: #{mem.mb} mb"
|
28
|
-
puts "After - Objects count: #{ObjectSpace.each_object.count}"
|
29
|
-
puts "After - Symbols count: #{Symbol.all_symbols.size}"
|
30
|
-
end
|
31
|
-
|
32
|
-
record_allocation do
|
33
|
-
data = 1_000_000.times.map { |i| "string_number_#{i}".to_sym } # array of symbols
|
34
|
-
Oj.dump(data, mode: :rails)
|
35
|
-
end
|