json 0.4.3 → 1.0.0

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.

Files changed (74) hide show
  1. data/CHANGES +6 -1
  2. data/README +49 -7
  3. data/Rakefile +216 -52
  4. data/TODO +1 -0
  5. data/VERSION +1 -1
  6. data/benchmarks/benchmark.txt +133 -0
  7. data/benchmarks/benchmark_generator.rb +44 -0
  8. data/benchmarks/benchmark_parser.rb +22 -0
  9. data/benchmarks/benchmark_rails.rb +26 -0
  10. data/data/example.json +1 -0
  11. data/data/index.html +37 -0
  12. data/data/prototype.js +2515 -0
  13. data/ext/json/ext/generator/Makefile +149 -0
  14. data/ext/json/ext/generator/extconf.rb +9 -0
  15. data/ext/json/ext/generator/generator.c +729 -0
  16. data/ext/json/ext/generator/unicode.c +184 -0
  17. data/ext/json/ext/generator/unicode.h +40 -0
  18. data/ext/json/ext/parser/Makefile +149 -0
  19. data/ext/json/ext/parser/extconf.rb +9 -0
  20. data/ext/json/ext/parser/parser.c +1551 -0
  21. data/ext/json/ext/parser/parser.rl +515 -0
  22. data/ext/json/ext/parser/unicode.c +156 -0
  23. data/ext/json/ext/parser/unicode.h +44 -0
  24. data/install.rb +13 -8
  25. data/lib/json.rb +101 -614
  26. data/lib/json/common.rb +184 -0
  27. data/lib/json/editor.rb +19 -10
  28. data/lib/json/ext.rb +13 -0
  29. data/lib/json/pure.rb +75 -0
  30. data/lib/json/pure/generator.rb +321 -0
  31. data/lib/json/pure/parser.rb +210 -0
  32. data/lib/json/version.rb +8 -0
  33. data/tests/fixtures/fail1.json +1 -0
  34. data/tests/fixtures/fail10.json +1 -0
  35. data/tests/fixtures/fail11.json +1 -0
  36. data/tests/fixtures/fail12.json +1 -0
  37. data/tests/fixtures/fail13.json +1 -0
  38. data/tests/fixtures/fail14.json +1 -0
  39. data/tests/fixtures/fail15.json +1 -0
  40. data/tests/fixtures/fail16.json +1 -0
  41. data/tests/fixtures/fail17.json +1 -0
  42. data/tests/fixtures/fail19.json +1 -0
  43. data/tests/fixtures/fail2.json +1 -0
  44. data/tests/fixtures/fail20.json +1 -0
  45. data/tests/fixtures/fail21.json +1 -0
  46. data/tests/fixtures/fail22.json +1 -0
  47. data/tests/fixtures/fail23.json +1 -0
  48. data/tests/fixtures/fail24.json +1 -0
  49. data/tests/fixtures/fail25.json +1 -0
  50. data/tests/fixtures/fail26.json +1 -0
  51. data/tests/fixtures/fail27.json +2 -0
  52. data/tests/fixtures/fail28.json +2 -0
  53. data/tests/fixtures/fail3.json +1 -0
  54. data/tests/fixtures/fail4.json +1 -0
  55. data/tests/fixtures/fail5.json +1 -0
  56. data/tests/fixtures/fail6.json +1 -0
  57. data/tests/fixtures/fail7.json +1 -0
  58. data/tests/fixtures/fail8.json +1 -0
  59. data/tests/fixtures/fail9.json +1 -0
  60. data/tests/fixtures/pass1.json +56 -0
  61. data/tests/fixtures/pass18.json +1 -0
  62. data/tests/fixtures/pass2.json +1 -0
  63. data/tests/fixtures/pass3.json +6 -0
  64. data/tests/runner.rb +8 -2
  65. data/tests/test_json.rb +102 -154
  66. data/tests/test_json_addition.rb +94 -0
  67. data/tests/test_json_fixtures.rb +30 -0
  68. data/tests/test_json_generate.rb +81 -0
  69. data/tests/test_json_unicode.rb +55 -0
  70. data/tools/fuzz.rb +133 -0
  71. data/tools/server.rb +62 -0
  72. metadata +87 -10
  73. data/bla.json.tmp +0 -0
  74. data/lib/json.rb.orig +0 -708
data/CHANGES CHANGED
@@ -1,3 +1,8 @@
1
+ 2007-03-24 (1.0.0)
2
+ * Added C implementations for the JSON generator and a ragel based JSON
3
+ parser in C.
4
+ * Much more tests, especially fixtures from json.org.
5
+ * Further improved conformance to RFC4627.
1
6
  2007-02-09 (0.4.3)
2
7
  * Conform more to RFC4627 for JSON: This means JSON strings
3
8
  now always must contain exactly one object "{ ... }" or array "[ ... ]" in
@@ -14,7 +19,7 @@
14
19
  * Fixed a bug in handling solidi (/-characters), that was reported by
15
20
  Kevin Gilpin <kevin.gilpin@alum.mit.edu>.
16
21
  2006-02-06 (0.4.1)
17
- * Fixed a bug concerning escaping with backslashes. Thanks for the report go
22
+ * Fixed a bug related to escaping with backslashes. Thanks for the report go
18
23
  to Florian Munz <surf@theflow.de>.
19
24
  2005-09-23 (0.4.0)
20
25
  * Initial Rubyforge Version
data/README CHANGED
@@ -1,27 +1,69 @@
1
+ Dependencies for Building
2
+ =========================
3
+
4
+ - You need rake to build the extensions and install them.
5
+
6
+ You can get it from rubyforge:
7
+ http://rubyforge.org/projects/rake
8
+
9
+ or just type
10
+
11
+ # gem install rake
12
+
13
+ for the installation via rubygems.
14
+
15
+ - If you want to rebuild the parser.c file or draw nice graphviz images of the
16
+ state machines, you need ragel from:
17
+ http://www.cs.queensu.ca/~thurston/ragel
18
+
1
19
  Installation
2
20
  ============
3
21
 
22
+ It's recommended to use the extension variant of JSON, because it's quite a bit
23
+ faster than the pure ruby variant. If you cannot build it on your system, you
24
+ can settle for the latter.
25
+
4
26
  Just type into the command line as root:
5
27
 
6
- # ruby install.rb
28
+ # rake install
29
+
30
+ The above command will build the extensions and install them on your system.
31
+
32
+ # rake install_pure
7
33
 
8
34
  or
9
35
 
10
- # rake install
36
+ # ruby install.rb
37
+
38
+ will just install the pure ruby implementation of JSON.
39
+
40
+ If you use Rubygems you can type
41
+
42
+ # gem install json
43
+
44
+ instead, to install the newest JSON version.
45
+
46
+ There is also a pure ruby json only variant of the gem, that can be installed
47
+ with:
48
+
49
+ # gem install json_pure
11
50
 
12
51
  Testing and Examples
13
52
  ====================
14
53
 
15
54
  To run the tests type:
16
55
 
17
- $ ruby -I lib tests/runner.rb
56
+ $ rake test_ext
18
57
 
19
- or
58
+ This will build the extensions first and then test them.
59
+
60
+ $ rake test_pure
20
61
 
21
- $ rake test
62
+ This will test the pure ruby extensions.
22
63
 
23
- To get an idea how this library is used also look at the tests (until I have
24
- time to better document it.)
64
+ There is also a small example in tools/server.rb if you want to see, how
65
+ receiving a JSON object from a webrick server in your browser with the
66
+ javasript prototype library (http://www.prototypejs.org) works.
25
67
 
26
68
  Author
27
69
  ======
data/Rakefile CHANGED
@@ -1,86 +1,250 @@
1
+ # vim: set et sw=2 ts=2:
1
2
  require 'rake/gempackagetask'
3
+ require 'rake/clean'
2
4
 
3
5
  require 'rbconfig'
4
6
  include Config
5
7
 
6
- PKG_NAME = 'json'
7
- PKG_VERSION = File.read('VERSION').chomp
8
- PKG_FILES = FileList["**/*"].exclude(/CVS|pkg|coverage/)
8
+ PKG_NAME = 'json'
9
+ PKG_VERSION = File.read('VERSION').chomp
10
+ PKG_FILES = FileList["**/*"].exclude(/CVS|pkg|coverage/)
11
+ EXT_ROOT_DIR = 'ext/json/ext'
12
+ EXT_PARSER_DIR = "#{EXT_ROOT_DIR}/parser"
13
+ EXT_PARSER_DL = "#{EXT_ROOT_DIR}/parser.#{CONFIG['DLEXT']}"
14
+ EXT_PARSER_SRC = "#{EXT_PARSER_DIR}/parser.c"
15
+ PKG_FILES << EXT_PARSER_SRC
16
+ EXT_GENERATOR_DIR = "#{EXT_ROOT_DIR}/generator"
17
+ EXT_GENERATOR_DL = "#{EXT_ROOT_DIR}/generator.#{CONFIG['DLEXT']}"
18
+ EXT_GENERATOR_SRC = "#{EXT_GENERATOR_DIR}/generator.c"
19
+ RAGEL_CODEGEN = %w[rlcodegen rlgen-cd].find { |c| system(c, '-v') }
20
+ RAGEL_PATH = "#{EXT_PARSER_DIR}/parser.rl"
21
+ CLEAN.include 'doc', 'coverage', FileList['diagrams/*.*'],
22
+ FileList["ext/**/*.{so,bundle,#{CONFIG['DLEXT']},o}"]
23
+
24
+ desc "Installing library (pure)"
25
+ task :install_pure => :version do
26
+ ruby 'install.rb'
27
+ end
9
28
 
10
- desc "Installing library"
11
- task :install do
12
- ruby 'install.rb'
29
+ desc "Installing library (extension)"
30
+ task :install_ext => [ :compile, :install_pure ] do
31
+ sitearchdir = CONFIG["sitearchdir"]
32
+ cd 'ext' do
33
+ for file in Dir["json/ext/*.#{CONFIG['DLEXT']}"]
34
+ d = File.join(sitearchdir, file)
35
+ mkdir_p File.dirname(d)
36
+ install(file, d)
37
+ end
38
+ end
13
39
  end
14
40
 
15
- desc "Testing library"
16
- task :test do
17
- ruby 'tests/runner.rb'
41
+ task :install => :install_ext
42
+
43
+ desc "Compiling extension"
44
+ task :compile => [ EXT_PARSER_DL, EXT_GENERATOR_DL ]
45
+
46
+ file EXT_PARSER_DL => EXT_PARSER_SRC do
47
+ cd EXT_PARSER_DIR do
48
+ ruby 'extconf.rb'
49
+ sh 'make'
50
+ end
51
+ cp "#{EXT_PARSER_DIR}/parser.#{CONFIG['DLEXT']}", EXT_ROOT_DIR
18
52
  end
19
53
 
20
- desc "Testing library with coverage"
21
- task :coverage do
22
- system 'rcov -x tests -Ilib tests/runner.rb'
54
+ file EXT_GENERATOR_DL => EXT_GENERATOR_SRC do
55
+ cd EXT_GENERATOR_DIR do
56
+ ruby 'extconf.rb'
57
+ sh 'make'
58
+ end
59
+ cp "#{EXT_GENERATOR_DIR}/generator.#{CONFIG['DLEXT']}", EXT_ROOT_DIR
60
+ end
61
+
62
+ desc "Generate parser with ragel"
63
+ task :ragel => EXT_PARSER_SRC
64
+
65
+ task :ragel_clean do
66
+ rm_rf EXT_PARSER_SRC
67
+ end
68
+
69
+ file EXT_PARSER_SRC => RAGEL_PATH do
70
+ cd EXT_PARSER_DIR do
71
+ sh "ragel parser.rl | #{RAGEL_CODEGEN} -G2"
72
+ end
73
+ end
74
+
75
+ desc "Generate diagrams of ragel parser (ps)"
76
+ task :ragel_dot_ps do
77
+ root = 'diagrams'
78
+ cd EXT_PARSER_DIR do
79
+ specs = []
80
+ File.new('parser.rl').grep(/^\s*machine\s*(\S+);\s*$/) { specs << $1 }
81
+ for s in specs
82
+ sh "ragel parser.rl -S#{s} | #{RAGEL_CODEGEN} -p -V|dot -Tps -o#{root}/#{s}.ps"
83
+ end
84
+ end
85
+ end
86
+
87
+ desc "Generate diagrams of ragel parser (png)"
88
+ task :ragel_dot_png do
89
+ root = 'diagrams'
90
+ cd EXT_PARSER_DIR do
91
+ specs = []
92
+ File.new('parser.rl').grep(/^\s*machine\s*(\S+);\s*$/) { specs << $1 }
93
+ for s in specs
94
+ sh "ragel parser.rl -S#{s} | #{RAGEL_CODEGEN} -p -V|dot -Tpng -o#{root}/#{s}.png"
95
+ end
96
+ end
97
+ end
98
+
99
+ desc "Generate diagrams of ragel parser"
100
+ task :ragel_dot => [ :ragel_dot_png, :ragel_dot_ps ]
101
+
102
+ desc "Testing library (pure ruby)"
103
+ task :test_pure => :clean do
104
+ ruby '-I lib tests/runner.rb'
23
105
  end
24
- desc "Removing generated files"
25
- task :clean do
26
- rm_rf 'doc'
106
+
107
+ desc "Testing library (extension)"
108
+ task :test_ext => :compile do
109
+ ruby '-I ext:lib tests/runner.rb'
27
110
  end
28
111
 
29
- # Create RDOC documentation.
30
- task :doc do
31
- sh 'rdoc -d -S -o doc lib/json.rb lib/json/editor.rb'
112
+ desc "Benchmarking parser (pure)"
113
+ task :benchmark_parser_pure do
114
+ ruby '-I lib benchmarks/benchmark_parser.rb'
32
115
  end
33
116
 
34
- spec = Gem::Specification.new do |s|
35
- #### Basic information.
117
+ desc "Benchmarking generator (pure)"
118
+ task :benchmark_generator_pure do
119
+ ruby '-I lib benchmarks/benchmark_generator.rb'
120
+ ruby 'benchmarks/benchmark_rails.rb'
121
+ end
36
122
 
37
- s.name = 'json'
38
- s.version = PKG_VERSION
39
- s.summary = "A JSON implementation in Ruby"
40
- s.description = ""
123
+ desc "Benchmarking library (pure)"
124
+ task :benchmark_pure => [ :benchmark_parser_pure, :benchmark_generator_pure ]
41
125
 
42
- #### Dependencies and requirements.
126
+ desc "Benchmarking parser (extension)"
127
+ task :benchmark_parser_ext => :compile do
128
+ ruby '-I ext:lib benchmarks/benchmark_parser.rb'
129
+ end
43
130
 
44
- #s.add_dependency('log4r', '> 1.0.4')
45
- #s.requirements << ""
131
+ desc "Benchmarking generator (extension)"
132
+ task :benchmark_generator_ext => :compile do
133
+ ruby '-I ext:lib benchmarks/benchmark_generator.rb'
134
+ ruby 'benchmarks/benchmark_rails.rb'
135
+ end
46
136
 
47
- s.files = PKG_FILES
137
+ desc "Benchmarking library (extension)"
138
+ task :benchmark_ext => [ :benchmark_parser_ext, :benchmark_generator_ext ]
48
139
 
49
- #### C code extensions.
140
+ task :benchmark do
141
+ puts "Benchmarking extension variant"
142
+ Rake::Task[:benchmark_ext].invoke
143
+ puts "Benchmarking pure variant"
144
+ Rake::Task[:benchmark_pure].invoke
145
+ end
50
146
 
51
- #s.extensions << "ext/extconf.rb"
147
+ desc "Testing library with coverage" # XXX broken
148
+ task :coverage do
149
+ system 'RUBYOPT="" rcov -x tests -Ilib tests/runner.rb'
150
+ end
52
151
 
53
- #### Load-time details: library and application (you will need one or both).
152
+ desc "Create RDOC documentation"
153
+ task :doc => [ :version, EXT_PARSER_SRC ] do
154
+ sh "rdoc -m JSON -d -S -o doc #{FileList['lib/**/*.rb']} #{EXT_PARSER_SRC} #{EXT_GENERATOR_SRC}"
155
+ end
54
156
 
55
- s.require_path = 'lib' # Use these for libraries.
56
- #s.autorequire = 'json'
157
+ spec_pure = Gem::Specification.new do |s|
158
+ s.name = 'json_pure'
159
+ s.version = PKG_VERSION
160
+ s.summary = "A JSON implementation in Ruby"
161
+ s.description = ""
57
162
 
58
- s.bindir = "bin" # Use these for applications.
59
- s.executables = ["edit_json.rb"]
60
- s.default_executable = "edit_json.rb"
163
+ s.files = PKG_FILES
61
164
 
62
- #### Documentation and testing.
165
+ s.require_path = 'lib'
63
166
 
64
- s.has_rdoc = true
65
- #s.extra_rdoc_files = rd.rdoc_files.reject { |fn| fn =~ /\.rb$/ }.to_a
66
- #s.rdoc_options <<
67
- # '--title' << 'Rake -- Ruby Make' <<
68
- # '--main' << 'README' <<
69
- # '--line-numbers'
70
- s.test_files << 'tests/runner.rb'
167
+ s.bindir = "bin"
168
+ s.executables = ["edit_json.rb"]
169
+ s.default_executable = "edit_json.rb"
71
170
 
72
- #### Author and project details.
171
+ s.has_rdoc = true
172
+ s.rdoc_options <<
173
+ '--title' << 'JSON -- A JSON implemention' <<
174
+ '--main' << 'JSON' << '--line-numbers'
175
+ s.test_files << 'tests/runner.rb'
73
176
 
74
- s.author = "Florian Frank"
75
- s.email = "flori@ping.de"
76
- s.homepage = "http://json.rubyforge.org"
77
- s.rubyforge_project = "json"
177
+ s.author = "Florian Frank"
178
+ s.email = "flori@ping.de"
179
+ s.homepage = "http://json.rubyforge.org"
180
+ s.rubyforge_project = "json"
78
181
  end
79
182
 
80
- Rake::GemPackageTask.new(spec) do |pkg|
183
+ Rake::GemPackageTask.new(spec_pure) do |pkg|
81
184
  pkg.need_tar = true
82
185
  pkg.package_files += PKG_FILES
83
186
  end
84
187
 
85
- task :release => [ :clean, :package ]
86
- # vim: set et sw=4 ts=4:
188
+ spec_ext = Gem::Specification.new do |s|
189
+ s.name = 'json'
190
+ s.version = PKG_VERSION
191
+ s.summary = "A JSON implementation as a Ruby extension"
192
+ s.description = ""
193
+
194
+ s.files = PKG_FILES
195
+
196
+ s.extensions <<
197
+ "#{EXT_PARSER_DIR}/extconf.rb" <<
198
+ "#{EXT_GENERATOR_DIR}/extconf.rb"
199
+
200
+ s.require_path = EXT_ROOT_DIR
201
+ s.require_paths << 'ext'
202
+ s.require_paths << 'lib'
203
+
204
+ s.bindir = "bin"
205
+ s.executables = ["edit_json.rb"]
206
+ s.default_executable = "edit_json.rb"
207
+
208
+ s.has_rdoc = true
209
+ s.rdoc_options <<
210
+ '--title' << 'JSON -- A JSON implemention' <<
211
+ '--main' << 'JSON' << '--line-numbers'
212
+ s.test_files << 'tests/runner.rb'
213
+
214
+ s.author = "Florian Frank"
215
+ s.email = "flori@ping.de"
216
+ s.homepage = "http://json.rubyforge.org"
217
+ s.rubyforge_project = "json"
218
+ end
219
+
220
+ Rake::GemPackageTask.new(spec_ext) do |pkg|
221
+ pkg.need_tar = true
222
+ pkg.package_files += PKG_FILES
223
+ end
224
+
225
+ task :mrproper => [ :ragel_clean, :clean ] do
226
+ for dir in [ EXT_PARSER_DIR, EXT_GENERATOR_DIR ]
227
+ cd(dir) { rm_f 'Makefile' }
228
+ end
229
+ end
230
+
231
+ desc m = "Writing version information for #{PKG_VERSION}"
232
+ task :version do
233
+ puts m
234
+ File.open(File.join('lib', 'json', 'version.rb'), 'w') do |v|
235
+ v.puts <<EOT
236
+ module JSON
237
+ # JSON version
238
+ VERSION = '#{PKG_VERSION}'
239
+ VERSION_ARRAY = VERSION.split(/\\./).map { |x| x.to_i } # :nodoc:
240
+ VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
241
+ VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
242
+ VERSION_BUILD = VERSION_ARRAY[2] # :nodoc:
243
+ end
244
+ EOT
245
+ end
246
+ end
247
+
248
+ task :release => [ :version, :clean, :ragel_clean, :ragel, :package ]
249
+
250
+ task :default => [ :version, :compile ]
data/TODO CHANGED
@@ -0,0 +1 @@
1
+ * Get the extension to compile on Windows, eventually?
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.3
1
+ 1.0.0
@@ -0,0 +1,133 @@
1
+ (in /home/flori/json)
2
+ Ragel Code Generator version 5.17 January 2007
3
+ Copyright (c) 2001-2006 by Adrian Thurston
4
+ Benchmarking extension variant
5
+ First run for warmup.
6
+ Running 'BC_Parser' for a duration of 10 secs per method:
7
+ real total utime stime cutime cstime
8
+ parser: 10.005944 10.010000 9.970000 0.040000 0.000000 0.000000
9
+ 5091 508.591409 0.001966
10
+ calls calls/sec secs/call
11
+ --------------------------------------------------------------------------------
12
+ Running 'BC_Parser' for a duration of 10 secs per method:
13
+ real total utime stime cutime cstime
14
+ parser: 10.006881 10.000000 9.950000 0.050000 0.000000 0.000000
15
+ 5055 505.500000 0.001978
16
+ calls calls/sec secs/call
17
+ --------------------------------------------------------------------------------
18
+ ================================================================================
19
+
20
+
21
+ [null,false,true,"f\u00d6\u00df\u00c4r",["n\u20acst\u20acd",true],{"quux":true,"foo\u00df":"b\u00e4r"}]
22
+ First run for warmup.
23
+ Running 'BC_Generator' for a duration of 10 secs per method:
24
+ real total utime stime cutime cstime
25
+ generator_pretty: 10.001066 10.010000 9.990000 0.020000 0.000000 0.000000
26
+ 3492 348.851149 0.002867
27
+ generator_fast : 10.002910 10.000000 9.980000 0.020000 0.000000 0.000000
28
+ 5416 541.600000 0.001846
29
+ generator_safe : 10.003107 10.010000 10.000000 0.010000 0.000000 0.000000
30
+ 4926 492.107892 0.002032
31
+ calls calls/sec secs/call
32
+ --------------------------------------------------------------------------------
33
+ Running 'BC_Generator' for a duration of 10 secs per method:
34
+ real total utime stime cutime cstime
35
+ generator_pretty: 10.009150 10.010000 10.010000 0.000000 0.000000 0.000000
36
+ 3511 350.749251 0.002851
37
+ generator_fast : 10.014407 10.020000 10.020000 0.000000 0.000000 0.000000
38
+ 5411 540.019960 0.001852
39
+ generator_safe : 10.010055 10.000000 10.000000 0.000000 0.000000 0.000000
40
+ 4933 493.300000 0.002027
41
+ calls calls/sec secs/call
42
+ --------------------------------------------------------------------------------
43
+ ================================================================================
44
+
45
+ Comparison in BC_Generator:
46
+ secs/call speed
47
+ generator_fast : 0.002 -> 1.540x
48
+ generator_safe : 0.002 -> 1.406x
49
+ generator_pretty: 0.003 -> 1.000x
50
+ --------------------------------------------------------------------------------
51
+
52
+ [null, false, true, "f\u00d6\u00df\u00c4r", ["n\u20acst\u20acd", true], {quux: true, "foo\u00df": "b\u00e4r"}]
53
+ First run for warmup.
54
+ Running 'BC_Rails' for a duration of 10 secs per method:
55
+ real total utime stime cutime cstime
56
+ generator: 10.026043 10.020000 10.020000 0.000000 0.000000 0.000000
57
+ 239 23.852295 0.041925
58
+ calls calls/sec secs/call
59
+ --------------------------------------------------------------------------------
60
+ Running 'BC_Rails' for a duration of 10 secs per method:
61
+ real total utime stime cutime cstime
62
+ generator: 10.010931 10.020000 10.010000 0.010000 0.000000 0.000000
63
+ 238 23.752495 0.042101
64
+ calls calls/sec secs/call
65
+ --------------------------------------------------------------------------------
66
+ ================================================================================
67
+
68
+
69
+ Benchmarking pure variant
70
+ First run for warmup.
71
+ Running 'BC_Parser' for a duration of 10 secs per method:
72
+ real total utime stime cutime cstime
73
+ parser: 10.022352 10.030000 10.020000 0.010000 0.000000 0.000000
74
+ 288 28.713858 0.034826
75
+ calls calls/sec secs/call
76
+ --------------------------------------------------------------------------------
77
+ Running 'BC_Parser' for a duration of 10 secs per method:
78
+ real total utime stime cutime cstime
79
+ parser: 10.006552 10.000000 10.000000 0.000000 0.000000 0.000000
80
+ 289 28.900000 0.034602
81
+ calls calls/sec secs/call
82
+ --------------------------------------------------------------------------------
83
+ ================================================================================
84
+
85
+
86
+ [null,false,true,"f\u00d6\u00df\u00c4r",["n\u20acst\u20acd",true],{"quux":true,"foo\u00df":"b\u00e4r"}]
87
+ First run for warmup.
88
+ Running 'BC_Generator' for a duration of 10 secs per method:
89
+ real total utime stime cutime cstime
90
+ generator_fast : 10.011644 10.010000 10.010000 0.000000 0.000000 0.000000
91
+ 411 41.058941 0.024355
92
+ generator_safe : 10.007100 10.010000 10.010000 0.000000 0.000000 0.000000
93
+ 352 35.164835 0.028438
94
+ generator_pretty: 10.008156 10.010000 10.010000 0.000000 0.000000 0.000000
95
+ 341 34.065934 0.029355
96
+ calls calls/sec secs/call
97
+ --------------------------------------------------------------------------------
98
+ Running 'BC_Generator' for a duration of 10 secs per method:
99
+ real total utime stime cutime cstime
100
+ generator_fast : 10.005185 10.010000 10.010000 0.000000 0.000000 0.000000
101
+ 411 41.058941 0.024355
102
+ generator_safe : 10.006932 10.010000 10.010000 0.000000 0.000000 0.000000
103
+ 351 35.064935 0.028519
104
+ generator_pretty: 10.007414 10.000000 10.000000 0.000000 0.000000 0.000000
105
+ 340 34.000000 0.029412
106
+ calls calls/sec secs/call
107
+ --------------------------------------------------------------------------------
108
+ ================================================================================
109
+
110
+ Comparison in BC_Generator:
111
+ secs/call speed
112
+ generator_fast : 0.024 -> 1.208x
113
+ generator_safe : 0.029 -> 1.031x
114
+ generator_pretty: 0.029 -> 1.000x
115
+ --------------------------------------------------------------------------------
116
+
117
+ [null, false, true, "f\u00d6\u00df\u00c4r", ["n\u20acst\u20acd", true], {quux: true, "foo\u00df": "b\u00e4r"}]
118
+ First run for warmup.
119
+ Running 'BC_Rails' for a duration of 10 secs per method:
120
+ real total utime stime cutime cstime
121
+ generator: 10.005748 10.000000 10.000000 0.000000 0.000000 0.000000
122
+ 240 24.000000 0.041667
123
+ calls calls/sec secs/call
124
+ --------------------------------------------------------------------------------
125
+ Running 'BC_Rails' for a duration of 10 secs per method:
126
+ real total utime stime cutime cstime
127
+ generator: 10.006764 10.010000 10.010000 0.000000 0.000000 0.000000
128
+ 239 23.876124 0.041883
129
+ calls calls/sec secs/call
130
+ --------------------------------------------------------------------------------
131
+ ================================================================================
132
+
133
+