scout 5.1.2 → 5.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +5 -0
- data/lib/scout.rb +1 -1
- data/lib/scout/server.rb +4 -1
- data/vendor/json_pure/CHANGES +43 -0
- data/vendor/json_pure/{RUBY → COPYING} +1 -1
- data/vendor/json_pure/GPL +7 -7
- data/vendor/json_pure/README +319 -39
- data/vendor/json_pure/Rakefile +69 -47
- data/vendor/json_pure/VERSION +1 -1
- data/vendor/json_pure/benchmarks/generator2_benchmark.rb +222 -0
- data/vendor/json_pure/benchmarks/generator_benchmark.rb +64 -5
- data/vendor/json_pure/benchmarks/ohai.json +1216 -0
- data/vendor/json_pure/benchmarks/ohai.ruby +1 -0
- data/vendor/json_pure/benchmarks/parser2_benchmark.rb +251 -0
- data/vendor/json_pure/benchmarks/parser_benchmark.rb +67 -5
- data/vendor/json_pure/ext/json/ext/generator/extconf.rb +9 -4
- data/vendor/json_pure/ext/json/ext/generator/generator.c +831 -409
- data/vendor/json_pure/ext/json/ext/generator/generator.h +170 -0
- data/vendor/json_pure/ext/json/ext/parser/extconf.rb +8 -4
- data/vendor/json_pure/ext/json/ext/parser/parser.c +292 -186
- data/vendor/json_pure/ext/json/ext/parser/parser.h +71 -0
- data/vendor/json_pure/ext/json/ext/parser/parser.rl +218 -112
- data/vendor/json_pure/lib/json/add/core.rb +20 -7
- data/vendor/json_pure/lib/json/add/rails.rb +2 -2
- data/vendor/json_pure/lib/json/common.rb +85 -42
- data/vendor/json_pure/lib/json/pure.rb +3 -3
- data/vendor/json_pure/lib/json/pure/generator.rb +112 -90
- data/vendor/json_pure/lib/json/pure/parser.rb +42 -4
- data/vendor/json_pure/lib/json/version.rb +1 -1
- data/vendor/json_pure/tests/test_json.rb +46 -18
- data/vendor/json_pure/tests/test_json_addition.rb +4 -6
- data/vendor/json_pure/tests/test_json_encoding.rb +68 -0
- data/vendor/json_pure/tests/test_json_generate.rb +30 -14
- data/vendor/json_pure/tests/test_json_rails.rb +5 -7
- data/vendor/json_pure/tests/test_json_unicode.rb +20 -6
- metadata +26 -15
- data/vendor/json_pure/doc-templates/main.txt +0 -283
- data/vendor/json_pure/ext/json/ext/generator/unicode.c +0 -182
- data/vendor/json_pure/ext/json/ext/generator/unicode.h +0 -53
- data/vendor/json_pure/ext/json/ext/parser/unicode.c +0 -154
- data/vendor/json_pure/ext/json/ext/parser/unicode.h +0 -58
data/vendor/json_pure/Rakefile
CHANGED
@@ -1,34 +1,53 @@
|
|
1
1
|
begin
|
2
2
|
require 'rake/gempackagetask'
|
3
|
+
rescue LoadError
|
4
|
+
end
|
5
|
+
|
6
|
+
begin
|
3
7
|
require 'rake/extensiontask'
|
4
8
|
rescue LoadError
|
9
|
+
puts "WARNING: rake-compiler is not installed. You will not be able to build the json gem until you install it."
|
5
10
|
end
|
6
|
-
require 'rake/clean'
|
7
11
|
|
8
12
|
require 'rbconfig'
|
9
13
|
include Config
|
10
14
|
|
15
|
+
require 'rake/clean'
|
16
|
+
CLOBBER.include Dir['benchmarks/data/*.{dat,log}'], FileList['**/*.rbc']
|
17
|
+
CLEAN.include FileList['diagrams/*.*'], 'doc', 'coverage', 'tmp',
|
18
|
+
FileList["ext/**/{Makefile,mkmf.log}"],
|
19
|
+
FileList["{ext,lib}/**/*.{so,bundle,#{CONFIG['DLEXT']},o,obj,pdb,lib,manifest,exp,def}"]
|
20
|
+
|
21
|
+
MAKE = ENV['MAKE'] || %w[gmake make].find { |c| system(c, '-v') }
|
11
22
|
PKG_NAME = 'json'
|
23
|
+
PKG_TITLE = 'JSON Implementation for Ruby'
|
12
24
|
PKG_VERSION = File.read('VERSION').chomp
|
13
|
-
PKG_FILES = FileList["**/*"].exclude(/CVS|pkg|tmp|coverage|Makefile
|
25
|
+
PKG_FILES = FileList["**/*"].exclude(/CVS|pkg|tmp|coverage|Makefile|\.nfs\./).exclude(/\.(so|bundle|o|#{CONFIG['DLEXT']})$/)
|
14
26
|
EXT_ROOT_DIR = 'ext/json/ext'
|
15
27
|
EXT_PARSER_DIR = "#{EXT_ROOT_DIR}/parser"
|
16
|
-
EXT_PARSER_DL = "#{
|
28
|
+
EXT_PARSER_DL = "#{EXT_PARSER_DIR}/parser.#{CONFIG['DLEXT']}"
|
17
29
|
EXT_PARSER_SRC = "#{EXT_PARSER_DIR}/parser.c"
|
18
30
|
PKG_FILES << EXT_PARSER_SRC
|
19
31
|
EXT_GENERATOR_DIR = "#{EXT_ROOT_DIR}/generator"
|
20
|
-
EXT_GENERATOR_DL = "#{
|
32
|
+
EXT_GENERATOR_DL = "#{EXT_GENERATOR_DIR}/generator.#{CONFIG['DLEXT']}"
|
21
33
|
EXT_GENERATOR_SRC = "#{EXT_GENERATOR_DIR}/generator.c"
|
22
34
|
RAGEL_CODEGEN = %w[rlcodegen rlgen-cd ragel].find { |c| system(c, '-v') }
|
23
35
|
RAGEL_DOTGEN = %w[rlgen-dot rlgen-cd ragel].find { |c| system(c, '-v') }
|
24
36
|
RAGEL_PATH = "#{EXT_PARSER_DIR}/parser.rl"
|
25
|
-
|
26
|
-
|
27
|
-
|
37
|
+
|
38
|
+
def myruby(*args, &block)
|
39
|
+
@myruby ||= File.join(CONFIG['bindir'], CONFIG['ruby_install_name'])
|
40
|
+
options = (Hash === args.last) ? args.pop : {}
|
41
|
+
if args.length > 1 then
|
42
|
+
sh(*([@myruby] + args + [options]), &block)
|
43
|
+
else
|
44
|
+
sh("#{@myruby} #{args.first}", options, &block)
|
45
|
+
end
|
46
|
+
end
|
28
47
|
|
29
48
|
desc "Installing library (pure)"
|
30
49
|
task :install_pure => :version do
|
31
|
-
|
50
|
+
myruby 'install.rb'
|
32
51
|
end
|
33
52
|
|
34
53
|
task :install_ext_really do
|
@@ -46,23 +65,27 @@ desc "Installing library (extension)"
|
|
46
65
|
task :install_ext => [ :compile_ext, :install_pure, :install_ext_really ]
|
47
66
|
|
48
67
|
desc "Installing library (extension)"
|
49
|
-
|
68
|
+
if RUBY_PLATFORM =~ /java/
|
69
|
+
task :install => :install_pure
|
70
|
+
else
|
71
|
+
task :install => :install_ext
|
72
|
+
end
|
50
73
|
|
51
74
|
desc "Compiling extension"
|
52
75
|
task :compile_ext => [ EXT_PARSER_DL, EXT_GENERATOR_DL ]
|
53
76
|
|
54
77
|
file EXT_PARSER_DL => EXT_PARSER_SRC do
|
55
78
|
cd EXT_PARSER_DIR do
|
56
|
-
|
57
|
-
|
79
|
+
myruby 'extconf.rb'
|
80
|
+
sh MAKE
|
58
81
|
end
|
59
82
|
cp "#{EXT_PARSER_DIR}/parser.#{CONFIG['DLEXT']}", EXT_ROOT_DIR
|
60
83
|
end
|
61
84
|
|
62
85
|
file EXT_GENERATOR_DL => EXT_GENERATOR_SRC do
|
63
86
|
cd EXT_GENERATOR_DIR do
|
64
|
-
|
65
|
-
|
87
|
+
myruby 'extconf.rb'
|
88
|
+
sh MAKE
|
66
89
|
end
|
67
90
|
cp "#{EXT_GENERATOR_DIR}/generator.#{CONFIG['DLEXT']}", EXT_ROOT_DIR
|
68
91
|
end
|
@@ -77,9 +100,9 @@ end
|
|
77
100
|
file EXT_PARSER_SRC => RAGEL_PATH do
|
78
101
|
cd EXT_PARSER_DIR do
|
79
102
|
if RAGEL_CODEGEN == 'ragel'
|
80
|
-
|
103
|
+
sh "ragel parser.rl -G2 -o parser.c"
|
81
104
|
else
|
82
|
-
|
105
|
+
sh "ragel -x parser.rl | #{RAGEL_CODEGEN} -G2"
|
83
106
|
end
|
84
107
|
end
|
85
108
|
end
|
@@ -89,11 +112,11 @@ task :ragel_dot_ps do
|
|
89
112
|
root = 'diagrams'
|
90
113
|
specs = []
|
91
114
|
File.new(RAGEL_PATH).grep(/^\s*machine\s*(\S+);\s*$/) { specs << $1 }
|
92
|
-
for s in specs
|
115
|
+
for s in specs
|
93
116
|
if RAGEL_DOTGEN == 'ragel'
|
94
|
-
|
117
|
+
sh "ragel #{RAGEL_PATH} -S#{s} -p -V | dot -Tps -o#{root}/#{s}.ps"
|
95
118
|
else
|
96
|
-
|
119
|
+
sh "ragel -x #{RAGEL_PATH} -S#{s} | #{RAGEL_DOTGEN} -p|dot -Tps -o#{root}/#{s}.ps"
|
97
120
|
end
|
98
121
|
end
|
99
122
|
end
|
@@ -103,11 +126,11 @@ task :ragel_dot_png do
|
|
103
126
|
root = 'diagrams'
|
104
127
|
specs = []
|
105
128
|
File.new(RAGEL_PATH).grep(/^\s*machine\s*(\S+);\s*$/) { specs << $1 }
|
106
|
-
for s in specs
|
129
|
+
for s in specs
|
107
130
|
if RAGEL_DOTGEN == 'ragel'
|
108
|
-
|
131
|
+
sh "ragel #{RAGEL_PATH} -S#{s} -p -V | dot -Tpng -o#{root}/#{s}.png"
|
109
132
|
else
|
110
|
-
|
133
|
+
sh "ragel -x #{RAGEL_PATH} -S#{s} | #{RAGEL_DOTGEN} -p|dot -Tpng -o#{root}/#{s}.png"
|
111
134
|
end
|
112
135
|
end
|
113
136
|
end
|
@@ -119,14 +142,14 @@ desc "Testing library (pure ruby)"
|
|
119
142
|
task :test_pure => :clean do
|
120
143
|
ENV['JSON'] = 'pure'
|
121
144
|
ENV['RUBYOPT'] = "-Iext:lib #{ENV['RUBYOPT']}"
|
122
|
-
|
145
|
+
myruby "-S testrb #{Dir['./tests/*.rb'] * ' '}"
|
123
146
|
end
|
124
147
|
|
125
148
|
desc "Testing library (extension)"
|
126
149
|
task :test_ext => :compile_ext do
|
127
150
|
ENV['JSON'] = 'ext'
|
128
151
|
ENV['RUBYOPT'] = "-Iext:lib #{ENV['RUBYOPT']}"
|
129
|
-
|
152
|
+
myruby "-S testrb #{Dir['./tests/*.rb'] * ' '}"
|
130
153
|
end
|
131
154
|
|
132
155
|
desc "Testing library (pure ruby and extension)"
|
@@ -135,33 +158,30 @@ task :test => [ :test_pure, :test_ext ]
|
|
135
158
|
desc "Benchmarking parser"
|
136
159
|
task :benchmark_parser do
|
137
160
|
ENV['RUBYOPT'] = "-Ilib:ext #{ENV['RUBYOPT']}"
|
138
|
-
|
161
|
+
myruby 'benchmarks/parser_benchmark.rb'
|
162
|
+
myruby 'benchmarks/parser2_benchmark.rb'
|
139
163
|
end
|
140
164
|
|
141
165
|
desc "Benchmarking generator"
|
142
166
|
task :benchmark_generator do
|
143
167
|
ENV['RUBYOPT'] = "-Ilib:ext #{ENV['RUBYOPT']}"
|
144
|
-
|
168
|
+
myruby 'benchmarks/generator_benchmark.rb'
|
169
|
+
myruby 'benchmarks/generator2_benchmark.rb'
|
145
170
|
end
|
146
171
|
|
147
172
|
desc "Benchmarking library"
|
148
173
|
task :benchmark => [ :benchmark_parser, :benchmark_generator ]
|
149
174
|
|
150
|
-
desc "Clean benchmark data"
|
151
|
-
task :clean_benchmark_data do
|
152
|
-
rm_rf Dir['benchmarks/data/*.{dat,log}']
|
153
|
-
end
|
154
|
-
|
155
175
|
desc "Create RDOC documentation"
|
156
176
|
task :doc => [ :version, EXT_PARSER_SRC ] do
|
157
|
-
|
177
|
+
sh "rdoc -o doc -t '#{PKG_TITLE}' -m README README lib/json.rb #{FileList['lib/json/**/*.rb']} #{EXT_PARSER_SRC} #{EXT_GENERATOR_SRC}"
|
158
178
|
end
|
159
179
|
|
160
|
-
if defined?(Gem) and defined?(Rake::GemPackageTask)
|
180
|
+
if defined?(Gem) and defined?(Rake::GemPackageTask)
|
161
181
|
spec_pure = Gem::Specification.new do |s|
|
162
182
|
s.name = 'json_pure'
|
163
183
|
s.version = PKG_VERSION
|
164
|
-
s.summary =
|
184
|
+
s.summary = PKG_TITLE
|
165
185
|
s.description = "This is a JSON implementation in pure Ruby."
|
166
186
|
|
167
187
|
s.files = PKG_FILES
|
@@ -173,26 +193,28 @@ if defined?(Gem) and defined?(Rake::GemPackageTask) and defined?(Rake::Extension
|
|
173
193
|
s.default_executable = "edit_json.rb"
|
174
194
|
|
175
195
|
s.has_rdoc = true
|
196
|
+
s.extra_rdoc_files << 'README'
|
176
197
|
s.rdoc_options <<
|
177
|
-
'--title' << 'JSON
|
178
|
-
'--main' << 'JSON' << '--line-numbers'
|
198
|
+
'--title' << 'JSON implemention for ruby' << '--main' << 'README'
|
179
199
|
s.test_files.concat Dir['tests/*.rb']
|
180
200
|
|
181
201
|
s.author = "Florian Frank"
|
182
202
|
s.email = "flori@ping.de"
|
183
|
-
s.homepage = "http://
|
203
|
+
s.homepage = "http://flori.github.com/#{PKG_NAME}"
|
184
204
|
s.rubyforge_project = "json"
|
185
205
|
end
|
186
206
|
|
187
207
|
Rake::GemPackageTask.new(spec_pure) do |pkg|
|
188
208
|
pkg.need_tar = true
|
189
|
-
pkg.package_files
|
209
|
+
pkg.package_files = PKG_FILES
|
190
210
|
end
|
211
|
+
end
|
191
212
|
|
213
|
+
if defined?(Gem) and defined?(Rake::GemPackageTask) and defined?(Rake::ExtensionTask)
|
192
214
|
spec_ext = Gem::Specification.new do |s|
|
193
215
|
s.name = 'json'
|
194
216
|
s.version = PKG_VERSION
|
195
|
-
s.summary =
|
217
|
+
s.summary = PKG_TITLE
|
196
218
|
s.description = "This is a JSON implementation as a Ruby extension in C."
|
197
219
|
|
198
220
|
s.files = PKG_FILES
|
@@ -208,14 +230,14 @@ if defined?(Gem) and defined?(Rake::GemPackageTask) and defined?(Rake::Extension
|
|
208
230
|
s.default_executable = "edit_json.rb"
|
209
231
|
|
210
232
|
s.has_rdoc = true
|
233
|
+
s.extra_rdoc_files << 'README'
|
211
234
|
s.rdoc_options <<
|
212
|
-
'--title' << 'JSON
|
213
|
-
'--main' << 'JSON' << '--line-numbers'
|
235
|
+
'--title' << 'JSON implemention for Ruby' << '--main' << 'README'
|
214
236
|
s.test_files.concat Dir['tests/*.rb']
|
215
237
|
|
216
238
|
s.author = "Florian Frank"
|
217
239
|
s.email = "flori@ping.de"
|
218
|
-
s.homepage = "http://
|
240
|
+
s.homepage = "http://flori.github.com/#{PKG_NAME}"
|
219
241
|
s.rubyforge_project = "json"
|
220
242
|
end
|
221
243
|
|
@@ -228,16 +250,16 @@ if defined?(Gem) and defined?(Rake::GemPackageTask) and defined?(Rake::Extension
|
|
228
250
|
ext.name = 'parser'
|
229
251
|
ext.gem_spec = spec_ext
|
230
252
|
ext.cross_compile = true
|
231
|
-
ext.cross_platform =
|
253
|
+
ext.cross_platform = %w[i386-mswin32 i386-mingw32]
|
232
254
|
ext.ext_dir = 'ext/json/ext/parser'
|
233
255
|
ext.lib_dir = 'lib/json/ext'
|
234
256
|
end
|
235
|
-
|
257
|
+
|
236
258
|
Rake::ExtensionTask.new do |ext|
|
237
259
|
ext.name = 'generator'
|
238
260
|
ext.gem_spec = spec_ext
|
239
261
|
ext.cross_compile = true
|
240
|
-
ext.cross_platform =
|
262
|
+
ext.cross_platform = %w[i386-mswin32 i386-mingw32]
|
241
263
|
ext.ext_dir = 'ext/json/ext/generator'
|
242
264
|
ext.lib_dir = 'lib/json/ext'
|
243
265
|
end
|
@@ -260,11 +282,11 @@ EOT
|
|
260
282
|
end
|
261
283
|
end
|
262
284
|
|
263
|
-
# TODO task :release => [ :version, :clean, :package_win ]
|
264
285
|
desc "Build all gems and archives for a new release."
|
265
286
|
task :release => [ :clean, :version, :cross, :native, :gem ] do
|
266
|
-
|
267
|
-
|
287
|
+
sh "#$0 clean native gem"
|
288
|
+
sh "#$0 clean package"
|
268
289
|
end
|
269
290
|
|
291
|
+
desc "Compile in the the source directory"
|
270
292
|
task :default => [ :version, :compile_ext ]
|
data/vendor/json_pure/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.4.2
|
@@ -0,0 +1,222 @@
|
|
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 = @big.to_json
|
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_ext"
|
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
|
+
|