json_pure 1.2.4 → 1.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGES CHANGED
@@ -1,3 +1,35 @@
1
+ 2010-08-09 (1.4.6)
2
+ * Fixed oversight reported in http://github.com/flori/json/issues/closed#issue/23,
3
+ always create a new object from the state prototype.
4
+ * Made pure and ext api more similar again.
5
+ 2010-08-07 (1.4.5)
6
+ * Manage data structure nesting depth in state object during generation. This
7
+ should reduce problems with to_json method definіtions that only have one
8
+ argument.
9
+ * Some fixes in the state objects and additional tests.
10
+ 2010-08-06 (1.4.4)
11
+ * Fixes build problem for rubinius under OS X, http://github.com/flori/json/issues/closed#issue/25
12
+ * Fixes crashes described in http://github.com/flori/json/issues/closed#issue/21 and
13
+ http://github.com/flori/json/issues/closed#issue/23
14
+ 2010-05-05 (1.4.3)
15
+ * Fixed some test assertions, from Ruby r27587 and r27590, patch by nobu.
16
+ * Fixed issue http://github.com/flori/json/issues/#issue/20 reported by
17
+ electronicwhisper@github. Thx!
18
+ 2010-04-26 (1.4.2)
19
+ * Applied patch from naruse Yui NARUSE <naruse@airemix.com> to make building with
20
+ Microsoft Visual C possible again.
21
+ * Applied patch from devrandom <c1.github@niftybox.net> in order to allow building of
22
+ json_pure if extensiontask is not present.
23
+ * Thanks to Dustin Schneider <dustin@stocktwits.com>, who reported a memory
24
+ leak, which is fixed in this release.
25
+ * Applied 993f261ccb8f911d2ae57e9db48ec7acd0187283 patch from josh@github.
26
+ 2010-04-25 (1.4.1)
27
+ * Fix for a bug reported by Dan DeLeo <dan@kallistec.com>, caused by T_FIXNUM
28
+ being different on 32bit/64bit architectures.
29
+ 2010-04-23 (1.4.0)
30
+ * Major speed improvements and building with simplified
31
+ directory/file-structure.
32
+ * Extension should at least be comapatible with MRI, YARV and Rubinius.
1
33
  2010-04-07 (1.2.4)
2
34
  * Triger const_missing callback to make Rails' dynamic class loading work.
3
35
  2010-03-11 (1.2.3)
data/README CHANGED
@@ -1,6 +1,4 @@
1
- == json - JSON Implementation for Ruby
2
-
3
- === Description
1
+ == Description
4
2
 
5
3
  This is a implementation of the JSON specification according to RFC 4627
6
4
  http://www.ietf.org/rfc/rfc4627.txt . Starting from version 1.0.0 on there
@@ -13,13 +11,11 @@ will be two variants available:
13
11
  generated by the ragel state machine compiler
14
12
  http://www.cs.queensu.ca/~thurston/ragel .
15
13
 
16
- Both variants of the JSON generator escape all non-ASCII and control characters
17
- with \uXXXX escape sequences, and support UTF-16 surrogate pairs in order to be
18
- able to generate the whole range of unicode code points. This means that
19
- generated JSON document is encoded as UTF-8 (because ASCII is a subset of
20
- UTF-8) and at the same time avoids decoding problems for receiving endpoints,
21
- that don't expect UTF-8 encoded texts. On the negative side this may lead to a
22
- bit longer strings than necessarry.
14
+ Both variants of the JSON generator generate UTF-8 character sequences by
15
+ default. If an :ascii_only option with a true value is given, they escape all
16
+ non-ASCII and control characters with \uXXXX escape sequences, and support
17
+ UTF-16 surrogate pairs in order to be able to generate the whole range of
18
+ unicode code points.
23
19
 
24
20
  All strings, that are to be encoded as JSON strings, should be UTF-8 byte
25
21
  sequences on the Ruby side. To encode raw binary strings, that aren't UTF-8
@@ -34,7 +30,7 @@ String#encoding set. If a document string has ASCII-8BIT as an encoding the
34
30
  parser attempts to figure out which of the UTF encodings from above it is and
35
31
  trys to parse it.
36
32
 
37
- === Installation
33
+ == Installation
38
34
 
39
35
  It's recommended to use the extension variant of JSON, because it's faster than
40
36
  the pure ruby variant. If you cannot build it on your system, you can settle
@@ -65,7 +61,7 @@ with:
65
61
 
66
62
  # gem install json_pure
67
63
 
68
- === Compiling the extensions yourself
64
+ == Compiling the extensions yourself
69
65
 
70
66
  If you want to build the extensions yourself you need rake:
71
67
 
@@ -82,7 +78,7 @@ If you want to create the parser.c file from its parser.rl file or draw nice
82
78
  graphviz images of the state machines, you need ragel from: http://www.cs.queensu.ca/~thurston/ragel
83
79
 
84
80
 
85
- === Usage
81
+ == Usage
86
82
 
87
83
  To use JSON you can
88
84
  require 'json'
@@ -136,7 +132,7 @@ To get the best compatibility to rails' JSON implementation, you can
136
132
  Both of the additions attempt to require 'json' (like above) first, if it has
137
133
  not been required yet.
138
134
 
139
- === More Examples
135
+ == More Examples
140
136
 
141
137
  To create a JSON document from a ruby data structure, you can call
142
138
  JSON.generate like that:
@@ -226,7 +222,7 @@ The script tools/server.rb contains a small example if you want to test, how
226
222
  receiving a JSON object from a webrick server in your browser with the
227
223
  javasript prototype library http://www.prototypejs.org works.
228
224
 
229
- === Speed Comparisons
225
+ == Speed Comparisons
230
226
 
231
227
  I have created some benchmark results (see the benchmarks/data-p4-3Ghz
232
228
  subdir of the package) for the JSON-parser to estimate the speed up in the C
@@ -339,17 +335,17 @@ Here are the median comparisons for completeness' sake:
339
335
  calls/sec ( time) -> speed covers
340
336
  secs/call
341
337
 
342
- === Author
338
+ == Author
343
339
 
344
340
  Florian Frank <mailto:flori@ping.de>
345
341
 
346
- === License
342
+ == License
347
343
 
348
344
  Ruby License, see the COPYING file included in the source distribution. The
349
345
  Ruby License includes the GNU General Public License (GPL), Version 2, so see
350
346
  the file GPL as well.
351
347
 
352
- === Download
348
+ == Download
353
349
 
354
350
  The latest version of this library can be downloaded at
355
351
 
data/Rakefile CHANGED
@@ -9,30 +9,31 @@ rescue LoadError
9
9
  puts "WARNING: rake-compiler is not installed. You will not be able to build the json gem until you install it."
10
10
  end
11
11
 
12
- require 'rake/clean'
13
- CLOBBER.include Dir['benchmarks/data/*.{dat,log}']
14
-
15
12
  require 'rbconfig'
16
13
  include Config
17
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
+
18
21
  MAKE = ENV['MAKE'] || %w[gmake make].find { |c| system(c, '-v') }
19
22
  PKG_NAME = 'json'
23
+ PKG_TITLE = 'JSON Implementation for Ruby'
20
24
  PKG_VERSION = File.read('VERSION').chomp
21
25
  PKG_FILES = FileList["**/*"].exclude(/CVS|pkg|tmp|coverage|Makefile|\.nfs\./).exclude(/\.(so|bundle|o|#{CONFIG['DLEXT']})$/)
22
26
  EXT_ROOT_DIR = 'ext/json/ext'
23
27
  EXT_PARSER_DIR = "#{EXT_ROOT_DIR}/parser"
24
- EXT_PARSER_DL = "#{EXT_ROOT_DIR}/parser.#{CONFIG['DLEXT']}"
28
+ EXT_PARSER_DL = "#{EXT_PARSER_DIR}/parser.#{CONFIG['DLEXT']}"
25
29
  EXT_PARSER_SRC = "#{EXT_PARSER_DIR}/parser.c"
26
30
  PKG_FILES << EXT_PARSER_SRC
27
31
  EXT_GENERATOR_DIR = "#{EXT_ROOT_DIR}/generator"
28
- EXT_GENERATOR_DL = "#{EXT_ROOT_DIR}/generator.#{CONFIG['DLEXT']}"
32
+ EXT_GENERATOR_DL = "#{EXT_GENERATOR_DIR}/generator.#{CONFIG['DLEXT']}"
29
33
  EXT_GENERATOR_SRC = "#{EXT_GENERATOR_DIR}/generator.c"
30
34
  RAGEL_CODEGEN = %w[rlcodegen rlgen-cd ragel].find { |c| system(c, '-v') }
31
35
  RAGEL_DOTGEN = %w[rlgen-dot rlgen-cd ragel].find { |c| system(c, '-v') }
32
36
  RAGEL_PATH = "#{EXT_PARSER_DIR}/parser.rl"
33
- CLEAN.include FileList['diagrams/*.*'], 'doc', 'coverage', 'tmp',
34
- FileList["ext/**/{Makefile,mkmf.log}"],
35
- FileList["{ext,lib}/**/*.{so,bundle,#{CONFIG['DLEXT']},o,obj,pdb,lib,manifest,exp,def}"]
36
37
 
37
38
  def myruby(*args, &block)
38
39
  @myruby ||= File.join(CONFIG['bindir'], CONFIG['ruby_install_name'])
@@ -158,12 +159,14 @@ desc "Benchmarking parser"
158
159
  task :benchmark_parser do
159
160
  ENV['RUBYOPT'] = "-Ilib:ext #{ENV['RUBYOPT']}"
160
161
  myruby 'benchmarks/parser_benchmark.rb'
162
+ myruby 'benchmarks/parser2_benchmark.rb'
161
163
  end
162
164
 
163
165
  desc "Benchmarking generator"
164
166
  task :benchmark_generator do
165
167
  ENV['RUBYOPT'] = "-Ilib:ext #{ENV['RUBYOPT']}"
166
168
  myruby 'benchmarks/generator_benchmark.rb'
169
+ myruby 'benchmarks/generator2_benchmark.rb'
167
170
  end
168
171
 
169
172
  desc "Benchmarking library"
@@ -171,14 +174,14 @@ task :benchmark => [ :benchmark_parser, :benchmark_generator ]
171
174
 
172
175
  desc "Create RDOC documentation"
173
176
  task :doc => [ :version, EXT_PARSER_SRC ] do
174
- sh "rdoc -o doc -m README README lib/json.rb #{FileList['lib/json/**/*.rb']} #{EXT_PARSER_SRC} #{EXT_GENERATOR_SRC}"
177
+ sh "sdoc -o doc -t '#{PKG_TITLE}' -m README README lib/json.rb #{FileList['lib/json/**/*.rb']} #{EXT_PARSER_SRC} #{EXT_GENERATOR_SRC}"
175
178
  end
176
179
 
177
- if defined?(Gem) and defined?(Rake::GemPackageTask) and defined?(Rake::ExtensionTask)
180
+ if defined?(Gem) and defined?(Rake::GemPackageTask)
178
181
  spec_pure = Gem::Specification.new do |s|
179
182
  s.name = 'json_pure'
180
183
  s.version = PKG_VERSION
181
- s.summary = "A JSON implementation in Ruby"
184
+ s.summary = PKG_TITLE
182
185
  s.description = "This is a JSON implementation in pure Ruby."
183
186
 
184
187
  s.files = PKG_FILES
@@ -192,7 +195,7 @@ if defined?(Gem) and defined?(Rake::GemPackageTask) and defined?(Rake::Extension
192
195
  s.has_rdoc = true
193
196
  s.extra_rdoc_files << 'README'
194
197
  s.rdoc_options <<
195
- '--title' << 'JSON -- A JSON implemention' << '--main' << 'README'
198
+ '--title' << 'JSON implemention for ruby' << '--main' << 'README'
196
199
  s.test_files.concat Dir['tests/*.rb']
197
200
 
198
201
  s.author = "Florian Frank"
@@ -205,11 +208,13 @@ if defined?(Gem) and defined?(Rake::GemPackageTask) and defined?(Rake::Extension
205
208
  pkg.need_tar = true
206
209
  pkg.package_files = PKG_FILES
207
210
  end
211
+ end
208
212
 
213
+ if defined?(Gem) and defined?(Rake::GemPackageTask) and defined?(Rake::ExtensionTask)
209
214
  spec_ext = Gem::Specification.new do |s|
210
215
  s.name = 'json'
211
216
  s.version = PKG_VERSION
212
- s.summary = "A JSON implementation as a Ruby extension"
217
+ s.summary = PKG_TITLE
213
218
  s.description = "This is a JSON implementation as a Ruby extension in C."
214
219
 
215
220
  s.files = PKG_FILES
@@ -227,7 +232,7 @@ if defined?(Gem) and defined?(Rake::GemPackageTask) and defined?(Rake::Extension
227
232
  s.has_rdoc = true
228
233
  s.extra_rdoc_files << 'README'
229
234
  s.rdoc_options <<
230
- '--title' << 'JSON -- A JSON implemention' << '--main' << 'README'
235
+ '--title' << 'JSON implemention for Ruby' << '--main' << 'README'
231
236
  s.test_files.concat Dir['tests/*.rb']
232
237
 
233
238
  s.author = "Florian Frank"
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.4
1
+ 1.4.6
@@ -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
+
@@ -12,6 +12,10 @@ when 'pure'
12
12
  require 'json/pure'
13
13
  when 'rails'
14
14
  require 'active_support'
15
+ when 'yajl'
16
+ require 'yajl'
17
+ require 'yajl/json_gem'
18
+ require 'stringio'
15
19
  end
16
20
 
17
21
  module JSON
@@ -23,7 +27,7 @@ module GeneratorBenchmarkCommon
23
27
 
24
28
  def setup
25
29
  a = [ nil, false, true, "fÖßÄr", [ "n€st€d", true ], { "fooß" => "bär", "quux" => true } ]
26
- puts a.to_json
30
+ puts a.to_json if a.respond_to?(:to_json)
27
31
  @big = a * 100
28
32
  end
29
33
 
@@ -52,15 +56,22 @@ module JSONGeneratorCommon
52
56
  end
53
57
 
54
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
55
65
  end
56
66
 
57
67
  class GeneratorBenchmarkExt < Bullshit::RepeatCase
58
68
  include JSONGeneratorCommon
59
69
 
60
70
  warmup yes
61
- iterations 1000
71
+ iterations 2000
62
72
 
63
73
  truncate_data do
74
+ enabled false
64
75
  alpha_level 0.05
65
76
  window_size 50
66
77
  slope_angle 0.1
@@ -83,9 +94,10 @@ class GeneratorBenchmarkPure < Bullshit::RepeatCase
83
94
  include JSONGeneratorCommon
84
95
 
85
96
  warmup yes
86
- iterations 1000
97
+ iterations 400
87
98
 
88
99
  truncate_data do
100
+ enabled false
89
101
  alpha_level 0.05
90
102
  window_size 50
91
103
  slope_angle 0.1
@@ -107,9 +119,10 @@ class GeneratorBenchmarkRails < Bullshit::RepeatCase
107
119
  include GeneratorBenchmarkCommon
108
120
 
109
121
  warmup yes
110
- iterations 1000
122
+ iterations 400
111
123
 
112
124
  truncate_data do
125
+ enabled false
113
126
  alpha_level 0.05
114
127
  window_size 50
115
128
  slope_angle 0.1
@@ -133,6 +146,45 @@ class GeneratorBenchmarkRails < Bullshit::RepeatCase
133
146
  alias reset_benchmark_generator generic_reset_method
134
147
  end
135
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
+
136
188
  if $0 == __FILE__
137
189
  Bullshit::Case.autorun false
138
190
 
@@ -143,22 +195,29 @@ if $0 == __FILE__
143
195
  GeneratorBenchmarkPure.run
144
196
  when 'rails'
145
197
  GeneratorBenchmarkRails.run
198
+ when 'yajl'
199
+ GeneratorBenchmarkYajl.run
146
200
  else
147
201
  system "#{RAKE_PATH} clean"
148
202
  system "#{RUBY_PATH} #$0 rails"
149
203
  system "#{RUBY_PATH} #$0 pure"
150
204
  system "#{RAKE_PATH} compile_ext"
151
205
  system "#{RUBY_PATH} #$0 ext"
206
+ system "#{RUBY_PATH} #$0 yajl"
152
207
  Bullshit.compare do
153
208
  output_filename File.join(File.dirname(__FILE__), 'data', 'GeneratorBenchmarkComparison.log')
154
209
 
155
210
  benchmark GeneratorBenchmarkExt, :generator_fast, :load => yes
156
211
  benchmark GeneratorBenchmarkExt, :generator_safe, :load => yes
157
212
  benchmark GeneratorBenchmarkExt, :generator_pretty, :load => yes
213
+ benchmark GeneratorBenchmarkExt, :generator_ascii, :load => yes
158
214
  benchmark GeneratorBenchmarkPure, :generator_fast, :load => yes
159
215
  benchmark GeneratorBenchmarkPure, :generator_safe, :load => yes
160
216
  benchmark GeneratorBenchmarkPure, :generator_pretty, :load => yes
217
+ benchmark GeneratorBenchmarkPure, :generator_ascii, :load => yes
161
218
  benchmark GeneratorBenchmarkRails, :generator, :load => yes
219
+ benchmark GeneratorBenchmarkYajl, :generator, :load => yes
220
+ benchmark GeneratorBenchmarkYajl, :generator_gem_api, :load => yes
162
221
  end
163
222
  end
164
223
  end