json 1.6.5 → 1.6.6
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/.gitignore +3 -0
- data/.travis.yml +4 -3
- data/CHANGES +7 -0
- data/Gemfile +2 -2
- data/README.rdoc +1 -1
- data/Rakefile +48 -58
- data/VERSION +1 -1
- data/ext/json/ext/generator/generator.c +17 -8
- data/ext/json/ext/generator/generator.h +1 -0
- data/install.rb +7 -3
- data/java/src/json/ext/StringDecoder.java +1 -0
- data/json.gemspec +6 -9
- data/json_pure.gemspec +5 -8
- data/lib/json/pure/generator.rb +6 -2
- data/lib/json/version.rb +1 -1
- data/tests/test_json.rb +3 -3
- data/tests/test_json_generate.rb +18 -16
- metadata +26 -63
- data/benchmarks/data-p4-3GHz-ruby18/.keep +0 -0
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkComparison.log +0 -52
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast-autocorrelation.dat +0 -1000
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast.dat +0 -1001
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty-autocorrelation.dat +0 -900
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty.dat +0 -901
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe-autocorrelation.dat +0 -1000
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe.dat +0 -1001
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt.log +0 -261
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast-autocorrelation.dat +0 -1000
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast.dat +0 -1001
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty-autocorrelation.dat +0 -1000
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty.dat +0 -1001
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe-autocorrelation.dat +0 -1000
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe.dat +0 -1001
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure.log +0 -262
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator-autocorrelation.dat +0 -1000
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator.dat +0 -1001
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails.log +0 -82
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkComparison.log +0 -34
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser-autocorrelation.dat +0 -900
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser.dat +0 -901
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt.log +0 -81
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser-autocorrelation.dat +0 -1000
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser.dat +0 -1001
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure.log +0 -82
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser-autocorrelation.dat +0 -1000
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser.dat +0 -1001
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails.log +0 -82
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser-autocorrelation.dat +0 -1000
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser.dat +0 -1001
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML.log +0 -82
- data/benchmarks/data/.keep +0 -0
- data/benchmarks/generator2_benchmark.rb +0 -222
- data/benchmarks/generator_benchmark.rb +0 -224
- data/benchmarks/ohai.json +0 -1216
- data/benchmarks/ohai.ruby +0 -1
- data/benchmarks/parser2_benchmark.rb +0 -251
- data/benchmarks/parser_benchmark.rb +0 -259
@@ -1,82 +0,0 @@
|
|
1
|
-
========================== 2009-04-01T16:46:41 CEST ===========================
|
2
|
-
Benchmarking on ruby 1.8.6 (2008-08-11 patchlevel 287) [i686-linux].
|
3
|
-
Running 'ParserBenchmarkYAML' for 1000 iterations/method (compare_time=real)
|
4
|
-
===============================================================================
|
5
|
-
|
6
|
-
This first run is only for warmup.
|
7
|
-
ParserBenchmarkYAML#parser:
|
8
|
-
real total user system
|
9
|
-
sum 4.506546021 4.490000000 4.480000000 0.010000000
|
10
|
-
min 0.003598928 0.000000000 0.000000000 0.000000000
|
11
|
-
std- 0.000288588 -0.001817113 -0.001826296 -0.000306228
|
12
|
-
mean 0.004506546 0.004490000 0.004480000 0.000010000
|
13
|
-
std+ 0.008724504 0.010797113 0.010786296 0.000326228
|
14
|
-
max 0.042540073 0.040000000 0.040000000 0.010000000
|
15
|
-
std 0.004217958 0.006307113 0.006306296 0.000316228
|
16
|
-
std% 93.596247306 140.470232048 140.765535944 3162.277660168
|
17
|
-
harm 0.003882332 nan nan nan
|
18
|
-
geo 0.004019118 0.000000000 0.000000000 0.000000000
|
19
|
-
q1 0.003660917 0.000000000 0.000000000 0.000000000
|
20
|
-
med 0.003705978 0.000000000 0.000000000 0.000000000
|
21
|
-
q3 0.003748715 0.010000000 0.010000000 0.000000000
|
22
|
-
1000 221.89943 0.004506546
|
23
|
-
calls calls/sec secs/call
|
24
|
-
|
25
|
-
0.04059 -|
|
26
|
-
0.03670 -|
|
27
|
-
0.03280 -|
|
28
|
-
0.02891 -|*
|
29
|
-
0.02502 -|
|
30
|
-
0.02112 -|
|
31
|
-
0.01723 -|
|
32
|
-
0.01333 -|
|
33
|
-
0.00944 -|
|
34
|
-
0.00555 -|**************************************************
|
35
|
-
|
36
|
-
Outliers detected with box plot algo (median=0.00371, iqr=0.00009, factor=3.00):
|
37
|
-
high=56 very_high=119
|
38
|
-
|
39
|
-
Ljung-Box statistics: q=433.20488 (alpha=0.05, df=50).
|
40
|
-
1.00000 >= 0.95000 => Autocorrelation was detected.
|
41
|
-
|
42
|
-
ParserBenchmarkYAML#parser:
|
43
|
-
real total user system
|
44
|
-
sum 4.454077959 4.430000000 4.420000000 0.010000000
|
45
|
-
min 0.003582954 0.000000000 0.000000000 0.000000000
|
46
|
-
std- 0.000263948 -0.001903657 -0.001912749 -0.000306228
|
47
|
-
mean 0.004454078 0.004430000 0.004420000 0.000010000
|
48
|
-
std+ 0.008644208 0.010763657 0.010752749 0.000326228
|
49
|
-
max 0.035927057 0.040000000 0.040000000 0.010000000
|
50
|
-
std 0.004190130 0.006333657 0.006332749 0.000316228
|
51
|
-
std% 94.074019869 142.971948832 143.274853190 3162.277660168
|
52
|
-
harm 0.003836471 nan nan nan
|
53
|
-
geo 0.003968258 0.000000000 0.000000000 0.000000000
|
54
|
-
q1 0.003650367 0.000000000 0.000000000 0.000000000
|
55
|
-
med 0.003690004 0.000000000 0.000000000 0.000000000
|
56
|
-
q3 0.003731966 0.010000000 0.010000000 0.000000000
|
57
|
-
1000 224.51336 0.004454078
|
58
|
-
calls calls/sec secs/call
|
59
|
-
|
60
|
-
0.03431 -|
|
61
|
-
0.03108 -|*
|
62
|
-
0.02784 -|*
|
63
|
-
0.02461 -|
|
64
|
-
0.02137 -|
|
65
|
-
0.01814 -|
|
66
|
-
0.01490 -|
|
67
|
-
0.01167 -|
|
68
|
-
0.00843 -|
|
69
|
-
0.00520 -|**************************************************
|
70
|
-
|
71
|
-
Outliers detected with box plot algo (median=0.00369, iqr=0.00008, factor=3.00):
|
72
|
-
high=58 very_high=100
|
73
|
-
|
74
|
-
Ljung-Box statistics: q=451.12745 (alpha=0.05, df=50).
|
75
|
-
1.00000 >= 0.95000 => Autocorrelation was detected.
|
76
|
-
|
77
|
-
No initial data truncated.
|
78
|
-
=> System may have been in a steady state from the beginning.
|
79
|
-
========================== 2009-04-01T16:46:54 CEST ===========================
|
80
|
-
|
81
|
-
Writing measurement data file '/data/scm/json/benchmarks/data/ParserBenchmarkYAML#parser.dat'.
|
82
|
-
Writing autocorrelation plot file '/data/scm/json/benchmarks/data/ParserBenchmarkYAML#parser-autocorrelation.dat'.
|
data/benchmarks/data/.keep
DELETED
File without changes
|
@@ -1,222 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# CODING: UTF-8
|
3
|
-
|
4
|
-
require 'rbconfig'
|
5
|
-
RUBY_PATH=File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name'])
|
6
|
-
RAKE_PATH=File.join(Config::CONFIG['bindir'], 'rake')
|
7
|
-
require 'bullshit'
|
8
|
-
case ARGV.first
|
9
|
-
when 'ext'
|
10
|
-
require 'json/ext'
|
11
|
-
when 'pure'
|
12
|
-
require 'json/pure'
|
13
|
-
when 'rails'
|
14
|
-
require 'active_support'
|
15
|
-
when 'yajl'
|
16
|
-
require 'yajl'
|
17
|
-
require 'yajl/json_gem'
|
18
|
-
require 'stringio'
|
19
|
-
end
|
20
|
-
|
21
|
-
module JSON
|
22
|
-
def self.[](*) end
|
23
|
-
end
|
24
|
-
|
25
|
-
module Generator2BenchmarkCommon
|
26
|
-
include JSON
|
27
|
-
|
28
|
-
def setup
|
29
|
-
@big = eval File.read(File.join(File.dirname(__FILE__), 'ohai.ruby'))
|
30
|
-
end
|
31
|
-
|
32
|
-
def generic_reset_method
|
33
|
-
@result and @result.size >= 16 or raise @result.to_s
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
module JSONGeneratorCommon
|
38
|
-
include Generator2BenchmarkCommon
|
39
|
-
|
40
|
-
def benchmark_generator_fast
|
41
|
-
@result = JSON.fast_generate(@big)
|
42
|
-
end
|
43
|
-
|
44
|
-
alias reset_benchmark_generator_fast generic_reset_method
|
45
|
-
|
46
|
-
def benchmark_generator_safe
|
47
|
-
@result = JSON.generate(@big)
|
48
|
-
end
|
49
|
-
|
50
|
-
alias reset_benchmark_generator_safe generic_reset_method
|
51
|
-
|
52
|
-
def benchmark_generator_pretty
|
53
|
-
@result = JSON.pretty_generate(@big)
|
54
|
-
end
|
55
|
-
|
56
|
-
alias reset_benchmark_generator_pretty generic_reset_method
|
57
|
-
|
58
|
-
def benchmark_generator_ascii
|
59
|
-
@result = JSON.generate(@big, :ascii_only => true)
|
60
|
-
end
|
61
|
-
|
62
|
-
alias reset_benchmark_generator_ascii generic_reset_method
|
63
|
-
end
|
64
|
-
|
65
|
-
class Generator2BenchmarkExt < Bullshit::RepeatCase
|
66
|
-
include JSONGeneratorCommon
|
67
|
-
|
68
|
-
warmup yes
|
69
|
-
iterations 2000
|
70
|
-
|
71
|
-
truncate_data do
|
72
|
-
enabled false
|
73
|
-
alpha_level 0.05
|
74
|
-
window_size 50
|
75
|
-
slope_angle 0.1
|
76
|
-
end
|
77
|
-
|
78
|
-
autocorrelation do
|
79
|
-
alpha_level 0.05
|
80
|
-
max_lags 50
|
81
|
-
file yes
|
82
|
-
end
|
83
|
-
|
84
|
-
|
85
|
-
output_dir File.join(File.dirname(__FILE__), 'data')
|
86
|
-
output_filename benchmark_name + '.log'
|
87
|
-
data_file yes
|
88
|
-
histogram yes
|
89
|
-
end
|
90
|
-
|
91
|
-
class Generator2BenchmarkPure < Bullshit::RepeatCase
|
92
|
-
include JSONGeneratorCommon
|
93
|
-
|
94
|
-
warmup yes
|
95
|
-
iterations 400
|
96
|
-
|
97
|
-
truncate_data do
|
98
|
-
enabled false
|
99
|
-
alpha_level 0.05
|
100
|
-
window_size 50
|
101
|
-
slope_angle 0.1
|
102
|
-
end
|
103
|
-
|
104
|
-
autocorrelation do
|
105
|
-
alpha_level 0.05
|
106
|
-
max_lags 50
|
107
|
-
file yes
|
108
|
-
end
|
109
|
-
|
110
|
-
output_dir File.join(File.dirname(__FILE__), 'data')
|
111
|
-
output_filename benchmark_name + '.log'
|
112
|
-
data_file yes
|
113
|
-
histogram yes
|
114
|
-
end
|
115
|
-
|
116
|
-
class Generator2BenchmarkRails < Bullshit::RepeatCase
|
117
|
-
include Generator2BenchmarkCommon
|
118
|
-
|
119
|
-
warmup yes
|
120
|
-
iterations 400
|
121
|
-
|
122
|
-
truncate_data do
|
123
|
-
enabled false
|
124
|
-
alpha_level 0.05
|
125
|
-
window_size 50
|
126
|
-
slope_angle 0.1
|
127
|
-
end
|
128
|
-
|
129
|
-
autocorrelation do
|
130
|
-
alpha_level 0.05
|
131
|
-
max_lags 50
|
132
|
-
file yes
|
133
|
-
end
|
134
|
-
|
135
|
-
output_dir File.join(File.dirname(__FILE__), 'data')
|
136
|
-
output_filename benchmark_name + '.log'
|
137
|
-
data_file yes
|
138
|
-
histogram yes
|
139
|
-
|
140
|
-
def benchmark_generator
|
141
|
-
@result = ActiveSupport::JSON.encode @big
|
142
|
-
end
|
143
|
-
|
144
|
-
alias reset_benchmark_generator generic_reset_method
|
145
|
-
end
|
146
|
-
|
147
|
-
class Generator2BenchmarkYajl < Bullshit::RepeatCase
|
148
|
-
include Generator2BenchmarkCommon
|
149
|
-
|
150
|
-
warmup yes
|
151
|
-
iterations 2000
|
152
|
-
|
153
|
-
truncate_data do
|
154
|
-
enabled false
|
155
|
-
alpha_level 0.05
|
156
|
-
window_size 50
|
157
|
-
slope_angle 0.1
|
158
|
-
end
|
159
|
-
|
160
|
-
autocorrelation do
|
161
|
-
alpha_level 0.05
|
162
|
-
max_lags 50
|
163
|
-
file yes
|
164
|
-
end
|
165
|
-
|
166
|
-
output_dir File.join(File.dirname(__FILE__), 'data')
|
167
|
-
output_filename benchmark_name + '.log'
|
168
|
-
data_file yes
|
169
|
-
histogram yes
|
170
|
-
|
171
|
-
def benchmark_generator
|
172
|
-
output = StringIO.new
|
173
|
-
Yajl::Encoder.new.encode(@big, output)
|
174
|
-
@result = output.string
|
175
|
-
end
|
176
|
-
|
177
|
-
def benchmark_generator_gem_api
|
178
|
-
@result = @big.to_json
|
179
|
-
end
|
180
|
-
|
181
|
-
def reset_benchmark_generator
|
182
|
-
generic_reset_method
|
183
|
-
end
|
184
|
-
end
|
185
|
-
|
186
|
-
if $0 == __FILE__
|
187
|
-
Bullshit::Case.autorun false
|
188
|
-
|
189
|
-
case ARGV.first
|
190
|
-
when 'ext'
|
191
|
-
Generator2BenchmarkExt.run
|
192
|
-
when 'pure'
|
193
|
-
Generator2BenchmarkPure.run
|
194
|
-
when 'rails'
|
195
|
-
Generator2BenchmarkRails.run
|
196
|
-
when 'yajl'
|
197
|
-
Generator2BenchmarkYajl.run
|
198
|
-
else
|
199
|
-
system "#{RAKE_PATH} clean"
|
200
|
-
system "#{RUBY_PATH} #$0 rails"
|
201
|
-
system "#{RUBY_PATH} #$0 pure"
|
202
|
-
system "#{RAKE_PATH} compile"
|
203
|
-
system "#{RUBY_PATH} #$0 ext"
|
204
|
-
system "#{RUBY_PATH} #$0 yajl"
|
205
|
-
Bullshit.compare do
|
206
|
-
output_filename File.join(File.dirname(__FILE__), 'data', 'Generator2BenchmarkComparison.log')
|
207
|
-
|
208
|
-
benchmark Generator2BenchmarkExt, :generator_fast, :load => yes
|
209
|
-
benchmark Generator2BenchmarkExt, :generator_safe, :load => yes
|
210
|
-
benchmark Generator2BenchmarkExt, :generator_pretty, :load => yes
|
211
|
-
benchmark Generator2BenchmarkExt, :generator_ascii, :load => yes
|
212
|
-
benchmark Generator2BenchmarkPure, :generator_fast, :load => yes
|
213
|
-
benchmark Generator2BenchmarkPure, :generator_safe, :load => yes
|
214
|
-
benchmark Generator2BenchmarkPure, :generator_pretty, :load => yes
|
215
|
-
benchmark Generator2BenchmarkPure, :generator_ascii, :load => yes
|
216
|
-
benchmark Generator2BenchmarkRails, :generator, :load => yes
|
217
|
-
benchmark Generator2BenchmarkYajl, :generator, :load => yes
|
218
|
-
benchmark Generator2BenchmarkYajl, :generator_gem_api, :load => yes
|
219
|
-
end
|
220
|
-
end
|
221
|
-
end
|
222
|
-
|
@@ -1,224 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# CODING: UTF-8
|
3
|
-
|
4
|
-
require 'rbconfig'
|
5
|
-
RUBY_PATH=File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name'])
|
6
|
-
RAKE_PATH=File.join(Config::CONFIG['bindir'], 'rake')
|
7
|
-
require 'bullshit'
|
8
|
-
case ARGV.first
|
9
|
-
when 'ext'
|
10
|
-
require 'json/ext'
|
11
|
-
when 'pure'
|
12
|
-
require 'json/pure'
|
13
|
-
when 'rails'
|
14
|
-
require 'active_support'
|
15
|
-
when 'yajl'
|
16
|
-
require 'yajl'
|
17
|
-
require 'yajl/json_gem'
|
18
|
-
require 'stringio'
|
19
|
-
end
|
20
|
-
|
21
|
-
module JSON
|
22
|
-
def self.[](*) end
|
23
|
-
end
|
24
|
-
|
25
|
-
module GeneratorBenchmarkCommon
|
26
|
-
include JSON
|
27
|
-
|
28
|
-
def setup
|
29
|
-
a = [ nil, false, true, "fÖßÄr", [ "n€st€d", true ], { "fooß" => "bär", "quux" => true } ]
|
30
|
-
puts a.to_json if a.respond_to?(:to_json)
|
31
|
-
@big = a * 100
|
32
|
-
end
|
33
|
-
|
34
|
-
def generic_reset_method
|
35
|
-
@result and @result.size > 2 + 6 * @big.size or raise @result.to_s
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
module JSONGeneratorCommon
|
40
|
-
include GeneratorBenchmarkCommon
|
41
|
-
|
42
|
-
def benchmark_generator_fast
|
43
|
-
@result = JSON.fast_generate(@big)
|
44
|
-
end
|
45
|
-
|
46
|
-
alias reset_benchmark_generator_fast generic_reset_method
|
47
|
-
|
48
|
-
def benchmark_generator_safe
|
49
|
-
@result = JSON.generate(@big)
|
50
|
-
end
|
51
|
-
|
52
|
-
alias reset_benchmark_generator_safe generic_reset_method
|
53
|
-
|
54
|
-
def benchmark_generator_pretty
|
55
|
-
@result = JSON.pretty_generate(@big)
|
56
|
-
end
|
57
|
-
|
58
|
-
alias reset_benchmark_generator_pretty generic_reset_method
|
59
|
-
|
60
|
-
def benchmark_generator_ascii
|
61
|
-
@result = JSON.generate(@big, :ascii_only => true)
|
62
|
-
end
|
63
|
-
|
64
|
-
alias reset_benchmark_generator_ascii generic_reset_method
|
65
|
-
end
|
66
|
-
|
67
|
-
class GeneratorBenchmarkExt < Bullshit::RepeatCase
|
68
|
-
include JSONGeneratorCommon
|
69
|
-
|
70
|
-
warmup yes
|
71
|
-
iterations 2000
|
72
|
-
|
73
|
-
truncate_data do
|
74
|
-
enabled false
|
75
|
-
alpha_level 0.05
|
76
|
-
window_size 50
|
77
|
-
slope_angle 0.1
|
78
|
-
end
|
79
|
-
|
80
|
-
autocorrelation do
|
81
|
-
alpha_level 0.05
|
82
|
-
max_lags 50
|
83
|
-
file yes
|
84
|
-
end
|
85
|
-
|
86
|
-
|
87
|
-
output_dir File.join(File.dirname(__FILE__), 'data')
|
88
|
-
output_filename benchmark_name + '.log'
|
89
|
-
data_file yes
|
90
|
-
histogram yes
|
91
|
-
end
|
92
|
-
|
93
|
-
class GeneratorBenchmarkPure < Bullshit::RepeatCase
|
94
|
-
include JSONGeneratorCommon
|
95
|
-
|
96
|
-
warmup yes
|
97
|
-
iterations 400
|
98
|
-
|
99
|
-
truncate_data do
|
100
|
-
enabled false
|
101
|
-
alpha_level 0.05
|
102
|
-
window_size 50
|
103
|
-
slope_angle 0.1
|
104
|
-
end
|
105
|
-
|
106
|
-
autocorrelation do
|
107
|
-
alpha_level 0.05
|
108
|
-
max_lags 50
|
109
|
-
file yes
|
110
|
-
end
|
111
|
-
|
112
|
-
output_dir File.join(File.dirname(__FILE__), 'data')
|
113
|
-
output_filename benchmark_name + '.log'
|
114
|
-
data_file yes
|
115
|
-
histogram yes
|
116
|
-
end
|
117
|
-
|
118
|
-
class GeneratorBenchmarkRails < Bullshit::RepeatCase
|
119
|
-
include GeneratorBenchmarkCommon
|
120
|
-
|
121
|
-
warmup yes
|
122
|
-
iterations 400
|
123
|
-
|
124
|
-
truncate_data do
|
125
|
-
enabled false
|
126
|
-
alpha_level 0.05
|
127
|
-
window_size 50
|
128
|
-
slope_angle 0.1
|
129
|
-
end
|
130
|
-
|
131
|
-
autocorrelation do
|
132
|
-
alpha_level 0.05
|
133
|
-
max_lags 50
|
134
|
-
file yes
|
135
|
-
end
|
136
|
-
|
137
|
-
output_dir File.join(File.dirname(__FILE__), 'data')
|
138
|
-
output_filename benchmark_name + '.log'
|
139
|
-
data_file yes
|
140
|
-
histogram yes
|
141
|
-
|
142
|
-
def benchmark_generator
|
143
|
-
@result = ActiveSupport::JSON.encode @big
|
144
|
-
end
|
145
|
-
|
146
|
-
alias reset_benchmark_generator generic_reset_method
|
147
|
-
end
|
148
|
-
|
149
|
-
class GeneratorBenchmarkYajl < Bullshit::RepeatCase
|
150
|
-
include GeneratorBenchmarkCommon
|
151
|
-
|
152
|
-
warmup yes
|
153
|
-
iterations 2000
|
154
|
-
|
155
|
-
truncate_data do
|
156
|
-
enabled false
|
157
|
-
alpha_level 0.05
|
158
|
-
window_size 50
|
159
|
-
slope_angle 0.1
|
160
|
-
end
|
161
|
-
|
162
|
-
autocorrelation do
|
163
|
-
alpha_level 0.05
|
164
|
-
max_lags 50
|
165
|
-
file yes
|
166
|
-
end
|
167
|
-
|
168
|
-
output_dir File.join(File.dirname(__FILE__), 'data')
|
169
|
-
output_filename benchmark_name + '.log'
|
170
|
-
data_file yes
|
171
|
-
histogram yes
|
172
|
-
|
173
|
-
def benchmark_generator
|
174
|
-
output = StringIO.new
|
175
|
-
Yajl::Encoder.new.encode(@big, output)
|
176
|
-
@result = output.string
|
177
|
-
end
|
178
|
-
|
179
|
-
def benchmark_generator_gem_api
|
180
|
-
@result = @big.to_json
|
181
|
-
end
|
182
|
-
|
183
|
-
def reset_benchmark_generator
|
184
|
-
generic_reset_method
|
185
|
-
end
|
186
|
-
end
|
187
|
-
|
188
|
-
if $0 == __FILE__
|
189
|
-
Bullshit::Case.autorun false
|
190
|
-
|
191
|
-
case ARGV.first
|
192
|
-
when 'ext'
|
193
|
-
GeneratorBenchmarkExt.run
|
194
|
-
when 'pure'
|
195
|
-
GeneratorBenchmarkPure.run
|
196
|
-
when 'rails'
|
197
|
-
GeneratorBenchmarkRails.run
|
198
|
-
when 'yajl'
|
199
|
-
GeneratorBenchmarkYajl.run
|
200
|
-
else
|
201
|
-
system "#{RAKE_PATH} clean"
|
202
|
-
system "#{RUBY_PATH} #$0 rails"
|
203
|
-
system "#{RUBY_PATH} #$0 pure"
|
204
|
-
system "#{RAKE_PATH} compile"
|
205
|
-
system "#{RUBY_PATH} #$0 ext"
|
206
|
-
system "#{RUBY_PATH} #$0 yajl"
|
207
|
-
Bullshit.compare do
|
208
|
-
output_filename File.join(File.dirname(__FILE__), 'data', 'GeneratorBenchmarkComparison.log')
|
209
|
-
|
210
|
-
benchmark GeneratorBenchmarkExt, :generator_fast, :load => yes
|
211
|
-
benchmark GeneratorBenchmarkExt, :generator_safe, :load => yes
|
212
|
-
benchmark GeneratorBenchmarkExt, :generator_pretty, :load => yes
|
213
|
-
benchmark GeneratorBenchmarkExt, :generator_ascii, :load => yes
|
214
|
-
benchmark GeneratorBenchmarkPure, :generator_fast, :load => yes
|
215
|
-
benchmark GeneratorBenchmarkPure, :generator_safe, :load => yes
|
216
|
-
benchmark GeneratorBenchmarkPure, :generator_pretty, :load => yes
|
217
|
-
benchmark GeneratorBenchmarkPure, :generator_ascii, :load => yes
|
218
|
-
benchmark GeneratorBenchmarkRails, :generator, :load => yes
|
219
|
-
benchmark GeneratorBenchmarkYajl, :generator, :load => yes
|
220
|
-
benchmark GeneratorBenchmarkYajl, :generator_gem_api, :load => yes
|
221
|
-
end
|
222
|
-
end
|
223
|
-
end
|
224
|
-
|