json_pure 1.1.3 → 1.1.4
Sign up to get free protection for your applications and to get access to all the features.
- 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/add/core.rb +1 -1
- data/lib/json/editor.rb +11 -2
- data/lib/json/ext.rb +2 -0
- data/lib/json/pure/generator.rb +77 -41
- data/lib/json/pure/parser.rb +6 -2
- data/lib/json/pure.rb +2 -0
- data/lib/json/version.rb +1 -1
- data/lib/json.rb +0 -221
- 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
data/CHANGES
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
2009-04-01 (1.1.4)
|
2
|
+
* Fixed a bug in the creation of serialized generic rails objects reported by
|
3
|
+
Friedrich Graeter <graeter@hydrixos.org>.
|
4
|
+
* Deleted tests/runner.rb, we're using testrb instead.
|
5
|
+
* Editor supports Infinity in numbers now.
|
6
|
+
* Made some changes in order to get the library to compile/run under Ruby
|
7
|
+
1.9.
|
8
|
+
* Improved speed of the code path for the fast_generate method in the pure
|
9
|
+
variant.
|
1
10
|
2008-07-10 (1.1.3)
|
2
11
|
* Wesley Beary <monki@geemus.com> reported a bug in json/add/core's DateTime
|
3
12
|
handling: If the nominator and denominator of the offset were divisible by
|
data/Rakefile
CHANGED
@@ -19,12 +19,12 @@ PKG_FILES << EXT_PARSER_SRC
|
|
19
19
|
EXT_GENERATOR_DIR = "#{EXT_ROOT_DIR}/generator"
|
20
20
|
EXT_GENERATOR_DL = "#{EXT_ROOT_DIR}/generator.#{CONFIG['DLEXT']}"
|
21
21
|
EXT_GENERATOR_SRC = "#{EXT_GENERATOR_DIR}/generator.c"
|
22
|
-
RAGEL_CODEGEN = %w[rlcodegen rlgen-cd].find { |c| system(c, '-v') }
|
23
|
-
RAGEL_DOTGEN = %w[rlgen-dot rlgen-cd].find { |c| system(c, '-v') }
|
22
|
+
RAGEL_CODEGEN = %w[rlcodegen rlgen-cd ragel].find { |c| system(c, '-v') }
|
23
|
+
RAGEL_DOTGEN = %w[rlgen-dot rlgen-cd ragel].find { |c| system(c, '-v') }
|
24
24
|
RAGEL_PATH = "#{EXT_PARSER_DIR}/parser.rl"
|
25
25
|
CLEAN.include 'doc', 'coverage', FileList['diagrams/*.*'],
|
26
26
|
FileList["ext/**/*.{so,bundle,#{CONFIG['DLEXT']},o,obj,pdb,lib,manifest,exp,def}"],
|
27
|
-
FileList["ext/**/Makefile"]
|
27
|
+
FileList["ext/**/{Makefile,mkmf.log}"]
|
28
28
|
|
29
29
|
|
30
30
|
desc "Installing library (pure)"
|
@@ -55,10 +55,10 @@ file EXT_PARSER_DL => EXT_PARSER_SRC do
|
|
55
55
|
cd EXT_PARSER_DIR do
|
56
56
|
ruby 'extconf.rb'
|
57
57
|
if ON_WINDOWS
|
58
|
-
|
59
|
-
|
58
|
+
system 'nmake'
|
59
|
+
system "mt -manifest parser.#{CONFIG['DLEXT']}.manifest -outputresource:parser.#{CONFIG['DLEXT']};2"
|
60
60
|
else
|
61
|
-
|
61
|
+
system 'make'
|
62
62
|
end
|
63
63
|
end
|
64
64
|
cp "#{EXT_PARSER_DIR}/parser.#{CONFIG['DLEXT']}", EXT_ROOT_DIR
|
@@ -68,10 +68,10 @@ file EXT_GENERATOR_DL => EXT_GENERATOR_SRC do
|
|
68
68
|
cd EXT_GENERATOR_DIR do
|
69
69
|
ruby 'extconf.rb'
|
70
70
|
if ON_WINDOWS
|
71
|
-
|
72
|
-
|
71
|
+
system 'nmake'
|
72
|
+
system "mt -manifest generator.#{CONFIG['DLEXT']}.manifest -outputresource:generator.#{CONFIG['DLEXT']};2"
|
73
73
|
else
|
74
|
-
|
74
|
+
system 'make'
|
75
75
|
end
|
76
76
|
end
|
77
77
|
cp "#{EXT_GENERATOR_DIR}/generator.#{CONFIG['DLEXT']}", EXT_ROOT_DIR
|
@@ -86,7 +86,11 @@ end
|
|
86
86
|
|
87
87
|
file EXT_PARSER_SRC => RAGEL_PATH do
|
88
88
|
cd EXT_PARSER_DIR do
|
89
|
-
|
89
|
+
if RAGEL_CODEGEN == 'ragel'
|
90
|
+
system "ragel parser.rl -G2 -o parser.c"
|
91
|
+
else
|
92
|
+
system "ragel -x parser.rl | #{RAGEL_CODEGEN} -G2"
|
93
|
+
end
|
90
94
|
end
|
91
95
|
end
|
92
96
|
|
@@ -96,7 +100,11 @@ task :ragel_dot_ps do
|
|
96
100
|
specs = []
|
97
101
|
File.new(RAGEL_PATH).grep(/^\s*machine\s*(\S+);\s*$/) { specs << $1 }
|
98
102
|
for s in specs
|
99
|
-
|
103
|
+
if RAGEL_DOTGEN == 'ragel'
|
104
|
+
system "ragel #{RAGEL_PATH} -S#{s} -p -V | dot -Tps -o#{root}/#{s}.ps"
|
105
|
+
else
|
106
|
+
system "ragel -x #{RAGEL_PATH} -S#{s} | #{RAGEL_DOTGEN} -p|dot -Tps -o#{root}/#{s}.ps"
|
107
|
+
end
|
100
108
|
end
|
101
109
|
end
|
102
110
|
|
@@ -106,7 +114,11 @@ task :ragel_dot_png do
|
|
106
114
|
specs = []
|
107
115
|
File.new(RAGEL_PATH).grep(/^\s*machine\s*(\S+);\s*$/) { specs << $1 }
|
108
116
|
for s in specs
|
109
|
-
|
117
|
+
if RAGEL_DOTGEN == 'ragel'
|
118
|
+
system "ragel #{RAGEL_PATH} -S#{s} -p -V | dot -Tpng -o#{root}/#{s}.png"
|
119
|
+
else
|
120
|
+
system "ragel -x #{RAGEL_PATH} -S#{s} | #{RAGEL_DOTGEN} -p|dot -Tpng -o#{root}/#{s}.png"
|
121
|
+
end
|
110
122
|
end
|
111
123
|
end
|
112
124
|
|
@@ -115,57 +127,39 @@ task :ragel_dot => [ :ragel_dot_png, :ragel_dot_ps ]
|
|
115
127
|
|
116
128
|
desc "Testing library (pure ruby)"
|
117
129
|
task :test_pure => :clean do
|
118
|
-
|
130
|
+
ENV['JSON'] = 'pure'
|
131
|
+
ENV['RUBYOPT'] = "-Iext:lib #{ENV['RUBYOPT']}"
|
132
|
+
system "testrb #{Dir['tests/*.rb'] * ' '}"
|
119
133
|
end
|
120
134
|
|
121
135
|
desc "Testing library (extension)"
|
122
136
|
task :test_ext => :compile do
|
123
|
-
|
137
|
+
ENV['JSON'] = 'ext'
|
138
|
+
ENV['RUBYOPT'] = "-Iext:lib #{ENV['RUBYOPT']}"
|
139
|
+
system "testrb #{Dir['tests/*.rb'] * ' '}"
|
124
140
|
end
|
125
141
|
|
126
|
-
desc "Benchmarking parser
|
127
|
-
task :
|
128
|
-
ruby '
|
142
|
+
desc "Benchmarking parser"
|
143
|
+
task :benchmark_parser do
|
144
|
+
ruby 'benchmarks/parser_benchmark.rb'
|
129
145
|
end
|
130
146
|
|
131
|
-
desc "Benchmarking generator
|
132
|
-
task :
|
133
|
-
ruby '
|
134
|
-
ruby 'benchmarks/benchmark_rails.rb'
|
147
|
+
desc "Benchmarking generator"
|
148
|
+
task :benchmark_generator do
|
149
|
+
ruby 'benchmarks/generator_benchmark.rb'
|
135
150
|
end
|
136
151
|
|
137
|
-
desc "Benchmarking library
|
138
|
-
task :
|
139
|
-
|
140
|
-
desc "Benchmarking parser (extension)"
|
141
|
-
task :benchmark_parser_ext => :compile do
|
142
|
-
ruby '-I ext:lib benchmarks/benchmark_parser.rb ext'
|
143
|
-
end
|
144
|
-
|
145
|
-
desc "Benchmarking generator (extension)"
|
146
|
-
task :benchmark_generator_ext => :compile do
|
147
|
-
ruby '-I ext:lib benchmarks/benchmark_generator.rb ext'
|
148
|
-
ruby 'benchmarks/benchmark_rails.rb'
|
149
|
-
end
|
150
|
-
|
151
|
-
desc "Benchmarking library (extension)"
|
152
|
-
task :benchmark_ext => [ :benchmark_parser_ext, :benchmark_generator_ext ]
|
153
|
-
|
154
|
-
task :benchmark do
|
155
|
-
puts "Benchmarking extension variant"
|
156
|
-
Rake::Task[:benchmark_ext].invoke
|
157
|
-
puts "Benchmarking pure variant"
|
158
|
-
Rake::Task[:benchmark_pure].invoke
|
159
|
-
end
|
152
|
+
desc "Benchmarking library"
|
153
|
+
task :benchmark => [ :benchmark_parser, :benchmark_generator ]
|
160
154
|
|
161
|
-
desc "
|
162
|
-
task :
|
163
|
-
|
155
|
+
desc "Clean benchmark data"
|
156
|
+
task :clean_benchmark_data do
|
157
|
+
rm_rf Dir['benchmarks/data/*.{dat,log}']
|
164
158
|
end
|
165
159
|
|
166
160
|
desc "Create RDOC documentation"
|
167
161
|
task :doc => [ :version, EXT_PARSER_SRC ] do
|
168
|
-
|
162
|
+
system "rdoc -S -o doc -m main.txt doc-templates/main.txt lib/json.rb #{FileList['lib/json/**/*.rb']} #{EXT_PARSER_SRC} #{EXT_GENERATOR_SRC}"
|
169
163
|
end
|
170
164
|
|
171
165
|
if defined? Gem
|
@@ -187,7 +181,7 @@ if defined? Gem
|
|
187
181
|
s.rdoc_options <<
|
188
182
|
'--title' << 'JSON -- A JSON implemention' <<
|
189
183
|
'--main' << 'JSON' << '--line-numbers'
|
190
|
-
s.test_files
|
184
|
+
s.test_files.concat Dir['tests/*.rb']
|
191
185
|
|
192
186
|
s.author = "Florian Frank"
|
193
187
|
s.email = "flori@ping.de"
|
@@ -224,7 +218,7 @@ if defined? Gem
|
|
224
218
|
s.rdoc_options <<
|
225
219
|
'--title' << 'JSON -- A JSON implemention' <<
|
226
220
|
'--main' << 'JSON' << '--line-numbers'
|
227
|
-
s.test_files
|
221
|
+
s.test_files.concat Dir['tests/*.rb']
|
228
222
|
|
229
223
|
s.author = "Florian Frank"
|
230
224
|
s.email = "flori@ping.de"
|
@@ -262,7 +256,7 @@ if defined? Gem
|
|
262
256
|
s.rdoc_options <<
|
263
257
|
'--title' << 'JSON -- A JSON implemention' <<
|
264
258
|
'--main' << 'JSON' << '--line-numbers'
|
265
|
-
s.test_files
|
259
|
+
s.test_files.concat Dir['tests/*.rb']
|
266
260
|
|
267
261
|
s.author = "Florian Frank"
|
268
262
|
s.email = "flori@ping.de"
|
@@ -276,9 +270,9 @@ if defined? Gem
|
|
276
270
|
end
|
277
271
|
end
|
278
272
|
|
279
|
-
task :mrproper => [ :ragel_clean, :clean ] do
|
273
|
+
task :mrproper => [ :ragel_clean, :clean, :clean_benchmark_data ] do
|
280
274
|
for dir in [ EXT_PARSER_DIR, EXT_GENERATOR_DIR ]
|
281
|
-
cd(dir) { rm_f
|
275
|
+
cd(dir) { rm_f %w[Makefile mkmf.log] }
|
282
276
|
end
|
283
277
|
end
|
284
278
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.
|
1
|
+
1.1.4
|
@@ -0,0 +1,52 @@
|
|
1
|
+
========================== 2009-04-01T16:54:14 CEST ===========================
|
2
|
+
|
3
|
+
Comparing times (call_time_mean):
|
4
|
+
1 GeneratorBenchmarkExt#generator_fast 1000 repeats:
|
5
|
+
547.354332608 ( real) -> 15.090x
|
6
|
+
0.001826970
|
7
|
+
2 GeneratorBenchmarkExt#generator_safe 1000 repeats:
|
8
|
+
443.968212317 ( real) -> 12.240x
|
9
|
+
0.002252414
|
10
|
+
3 GeneratorBenchmarkExt#generator_pretty 900 repeats:
|
11
|
+
375.104545883 ( real) -> 10.341x
|
12
|
+
0.002665923
|
13
|
+
4 GeneratorBenchmarkPure#generator_fast 1000 repeats:
|
14
|
+
49.978706968 ( real) -> 1.378x
|
15
|
+
0.020008521
|
16
|
+
5 GeneratorBenchmarkRails#generator 1000 repeats:
|
17
|
+
38.531868759 ( real) -> 1.062x
|
18
|
+
0.025952543
|
19
|
+
6 GeneratorBenchmarkPure#generator_safe 1000 repeats:
|
20
|
+
36.927649925 ( real) -> 1.018x 7 (>=3859)
|
21
|
+
0.027079979
|
22
|
+
7 GeneratorBenchmarkPure#generator_pretty 1000 repeats:
|
23
|
+
36.272134441 ( real) -> 1.000x 6 (>=3859)
|
24
|
+
0.027569373
|
25
|
+
calls/sec ( time) -> speed covers
|
26
|
+
secs/call
|
27
|
+
|
28
|
+
Comparing times (call_time_median):
|
29
|
+
1 GeneratorBenchmarkExt#generator_fast 1000 repeats:
|
30
|
+
708.258020939 ( real) -> 16.547x
|
31
|
+
0.001411915
|
32
|
+
2 GeneratorBenchmarkExt#generator_safe 1000 repeats:
|
33
|
+
569.105020353 ( real) -> 13.296x
|
34
|
+
0.001757145
|
35
|
+
3 GeneratorBenchmarkExt#generator_pretty 900 repeats:
|
36
|
+
482.825371244 ( real) -> 11.280x
|
37
|
+
0.002071142
|
38
|
+
4 GeneratorBenchmarkPure#generator_fast 1000 repeats:
|
39
|
+
62.717626652 ( real) -> 1.465x
|
40
|
+
0.015944481
|
41
|
+
5 GeneratorBenchmarkRails#generator 1000 repeats:
|
42
|
+
43.965681162 ( real) -> 1.027x
|
43
|
+
0.022745013
|
44
|
+
6 GeneratorBenchmarkPure#generator_safe 1000 repeats:
|
45
|
+
43.929073409 ( real) -> 1.026x 7 (>=3859)
|
46
|
+
0.022763968
|
47
|
+
7 GeneratorBenchmarkPure#generator_pretty 1000 repeats:
|
48
|
+
42.802514491 ( real) -> 1.000x 6 (>=3859)
|
49
|
+
0.023363113
|
50
|
+
calls/sec ( time) -> speed covers
|
51
|
+
secs/call
|
52
|
+
===============================================================================
|