json 1.1.3 → 1.1.4
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of json might be problematic. Click here for more details.
- data/CHANGES +9 -0
- data/Rakefile +47 -53
- data/VERSION +1 -1
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkComparison.log +52 -0
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast-autocorrelation.dat +1000 -0
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast.dat +1001 -0
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty-autocorrelation.dat +900 -0
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty.dat +901 -0
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe-autocorrelation.dat +1000 -0
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe.dat +1001 -0
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt.log +261 -0
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast-autocorrelation.dat +1000 -0
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast.dat +1001 -0
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty-autocorrelation.dat +1000 -0
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty.dat +1001 -0
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe-autocorrelation.dat +1000 -0
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe.dat +1001 -0
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure.log +262 -0
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator-autocorrelation.dat +1000 -0
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator.dat +1001 -0
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails.log +82 -0
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkComparison.log +34 -0
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser-autocorrelation.dat +900 -0
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser.dat +901 -0
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt.log +81 -0
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser-autocorrelation.dat +1000 -0
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser.dat +1001 -0
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure.log +82 -0
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser-autocorrelation.dat +1000 -0
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser.dat +1001 -0
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails.log +82 -0
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser-autocorrelation.dat +1000 -0
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser.dat +1001 -0
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML.log +82 -0
- data/benchmarks/generator_benchmark.rb +162 -0
- data/benchmarks/parser_benchmark.rb +193 -0
- data/bin/edit_json.rb +0 -1
- data/bin/prettify_json.rb +0 -1
- data/doc-templates/main.txt +284 -0
- data/ext/json/ext/generator/extconf.rb +2 -0
- data/ext/json/ext/generator/generator.c +62 -18
- data/ext/json/ext/parser/extconf.rb +2 -0
- data/ext/json/ext/parser/parser.c +128 -81
- data/ext/json/ext/parser/parser.rl +31 -7
- data/ext/json/ext/parser/unicode.c +4 -4
- data/lib/json.rb +0 -221
- data/lib/json/add/core.rb +1 -1
- data/lib/json/editor.rb +11 -2
- data/lib/json/ext.rb +2 -0
- data/lib/json/pure.rb +2 -0
- data/lib/json/pure/generator.rb +77 -41
- data/lib/json/pure/parser.rb +6 -2
- data/lib/json/version.rb +1 -1
- data/tests/test_json.rb +7 -4
- data/tests/test_json_addition.rb +8 -5
- data/tests/test_json_fixtures.rb +6 -2
- data/tests/test_json_generate.rb +8 -2
- data/tests/test_json_rails.rb +30 -2
- data/tests/test_json_unicode.rb +8 -7
- data/tools/fuzz.rb +0 -1
- data/tools/server.rb +0 -1
- metadata +46 -9
- data/benchmarks/benchmark.txt +0 -133
- data/benchmarks/benchmark_generator.rb +0 -48
- data/benchmarks/benchmark_parser.rb +0 -26
- data/benchmarks/benchmark_rails.rb +0 -26
- data/tests/runner.rb +0 -25
@@ -1,48 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'bullshit'
|
4
|
-
$KCODE='utf8'
|
5
|
-
if ARGV.shift == 'pure'
|
6
|
-
require 'json/pure'
|
7
|
-
else
|
8
|
-
require 'json/ext'
|
9
|
-
end
|
10
|
-
|
11
|
-
class BC_Generator < Bullshit::TimeCase
|
12
|
-
include JSON
|
13
|
-
|
14
|
-
warmup true
|
15
|
-
duration 10
|
16
|
-
|
17
|
-
def setup
|
18
|
-
a = [ nil, false, true, "fÖßÄr", [ "n€st€d", true ], { "fooß" => "bär", "quux" => true } ]
|
19
|
-
puts JSON[a]
|
20
|
-
@big = a * 100
|
21
|
-
end
|
22
|
-
|
23
|
-
def benchmark_generator_fast
|
24
|
-
@result = JSON.fast_generate(@big)
|
25
|
-
end
|
26
|
-
|
27
|
-
def reset_benchmark_generator_fast
|
28
|
-
@result and @result.size > 2 + 6 * @big.size or raise @result.to_s
|
29
|
-
end
|
30
|
-
|
31
|
-
def benchmark_generator_safe
|
32
|
-
@result = JSON.generate(@big)
|
33
|
-
end
|
34
|
-
|
35
|
-
def reset_benchmark_generator_safe
|
36
|
-
@result and @result.size > 2 + 6 * @big.size or raise @result.to_s
|
37
|
-
end
|
38
|
-
|
39
|
-
def benchmark_generator_pretty
|
40
|
-
@result = JSON.pretty_generate(@big)
|
41
|
-
end
|
42
|
-
|
43
|
-
def reset_benchmark_generator_pretty
|
44
|
-
@result and @result.size > 2 + 6 * @big.size or raise @result.to_s
|
45
|
-
end
|
46
|
-
|
47
|
-
compare :generator_fast, :generator_safe, :generator_pretty
|
48
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'bullshit'
|
4
|
-
if ARGV.shift == 'pure'
|
5
|
-
require 'json/pure'
|
6
|
-
else
|
7
|
-
require 'json/ext'
|
8
|
-
end
|
9
|
-
|
10
|
-
class BC_Parser < Bullshit::TimeCase
|
11
|
-
include JSON
|
12
|
-
|
13
|
-
warmup true
|
14
|
-
duration 10
|
15
|
-
|
16
|
-
def setup
|
17
|
-
a = [ nil, false, true, "fÖß\nÄr", [ "n€st€d", true ], { "fooß" => "bär", "qu\r\nux" => true } ]
|
18
|
-
@big = a * 100
|
19
|
-
@json = JSON.generate(@big)
|
20
|
-
end
|
21
|
-
|
22
|
-
def benchmark_parser
|
23
|
-
a = JSON.parse(@json)
|
24
|
-
a == @big or raise "not equal"
|
25
|
-
end
|
26
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'bullshit'
|
4
|
-
require 'active_support'
|
5
|
-
|
6
|
-
class BC_Rails < Bullshit::TimeCase
|
7
|
-
warmup true
|
8
|
-
duration 10
|
9
|
-
|
10
|
-
def setup
|
11
|
-
a = [ nil, false, true, "fÖßÄr", [ "n€st€d", true ], { "fooß" => "bär", "quux" => true } ]
|
12
|
-
puts a.to_json
|
13
|
-
@big = a * 100
|
14
|
-
end
|
15
|
-
|
16
|
-
def benchmark_generator
|
17
|
-
@result = @big.to_json
|
18
|
-
end
|
19
|
-
|
20
|
-
def reset_benchmark_generator
|
21
|
-
@result and @result.size > 2 + 6 * @big.size or raise @result.to_s
|
22
|
-
if stack = Thread.current[:json_reference_stack]
|
23
|
-
stack.clear
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
data/tests/runner.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'test/unit/ui/console/testrunner'
|
4
|
-
require 'test/unit/testsuite'
|
5
|
-
$:.unshift File.expand_path(File.dirname($0))
|
6
|
-
$:.unshift 'tests'
|
7
|
-
require 'test_json'
|
8
|
-
require 'test_json_generate'
|
9
|
-
require 'test_json_unicode'
|
10
|
-
require 'test_json_addition'
|
11
|
-
require 'test_json_rails'
|
12
|
-
require 'test_json_fixtures'
|
13
|
-
|
14
|
-
class TS_AllTests
|
15
|
-
def self.suite
|
16
|
-
suite = Test::Unit::TestSuite.new name
|
17
|
-
suite << TC_JSONGenerate.suite
|
18
|
-
suite << TC_JSON.suite
|
19
|
-
suite << TC_JSONUnicode.suite
|
20
|
-
suite << TC_JSONAddition.suite
|
21
|
-
suite << TC_JSONRails.suite
|
22
|
-
suite << TC_JSONFixtures.suite
|
23
|
-
end
|
24
|
-
end
|
25
|
-
Test::Unit::UI::Console::TestRunner.run(TS_AllTests)
|