json_pure 1.0.0 → 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.
Files changed (93) hide show
  1. data/CHANGES +155 -1
  2. data/COPYING +58 -0
  3. data/GPL +7 -7
  4. data/README +324 -45
  5. data/Rakefile +166 -124
  6. data/TODO +1 -1
  7. data/VERSION +1 -1
  8. data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkComparison.log +52 -0
  9. data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast-autocorrelation.dat +1000 -0
  10. data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast.dat +1001 -0
  11. data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty-autocorrelation.dat +900 -0
  12. data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty.dat +901 -0
  13. data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe-autocorrelation.dat +1000 -0
  14. data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe.dat +1001 -0
  15. data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt.log +261 -0
  16. data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast-autocorrelation.dat +1000 -0
  17. data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast.dat +1001 -0
  18. data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty-autocorrelation.dat +1000 -0
  19. data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty.dat +1001 -0
  20. data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe-autocorrelation.dat +1000 -0
  21. data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe.dat +1001 -0
  22. data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure.log +262 -0
  23. data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator-autocorrelation.dat +1000 -0
  24. data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator.dat +1001 -0
  25. data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails.log +82 -0
  26. data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkComparison.log +34 -0
  27. data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser-autocorrelation.dat +900 -0
  28. data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser.dat +901 -0
  29. data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt.log +81 -0
  30. data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser-autocorrelation.dat +1000 -0
  31. data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser.dat +1001 -0
  32. data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure.log +82 -0
  33. data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser-autocorrelation.dat +1000 -0
  34. data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser.dat +1001 -0
  35. data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails.log +82 -0
  36. data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser-autocorrelation.dat +1000 -0
  37. data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser.dat +1001 -0
  38. data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML.log +82 -0
  39. data/benchmarks/generator2_benchmark.rb +222 -0
  40. data/benchmarks/generator_benchmark.rb +224 -0
  41. data/benchmarks/ohai.json +1216 -0
  42. data/benchmarks/ohai.ruby +1 -0
  43. data/benchmarks/parser2_benchmark.rb +251 -0
  44. data/benchmarks/parser_benchmark.rb +259 -0
  45. data/bin/edit_json.rb +1 -3
  46. data/bin/prettify_json.rb +75 -0
  47. data/data/index.html +5 -4
  48. data/data/prototype.js +2764 -1095
  49. data/ext/json/ext/generator/extconf.rb +14 -3
  50. data/ext/json/ext/generator/generator.c +1022 -334
  51. data/ext/json/ext/generator/generator.h +197 -0
  52. data/ext/json/ext/parser/extconf.rb +9 -3
  53. data/ext/json/ext/parser/parser.c +961 -577
  54. data/ext/json/ext/parser/parser.h +71 -0
  55. data/ext/json/ext/parser/parser.rl +400 -123
  56. data/install.rb +0 -0
  57. data/lib/json/add/core.rb +148 -0
  58. data/lib/json/add/rails.rb +58 -0
  59. data/lib/json/common.rb +254 -47
  60. data/lib/json/editor.rb +236 -72
  61. data/lib/json/ext.rb +2 -0
  62. data/lib/json/pure/generator.rb +235 -117
  63. data/lib/json/pure/parser.rb +124 -25
  64. data/lib/json/pure.rb +5 -3
  65. data/lib/json/version.rb +1 -1
  66. data/lib/json.rb +2 -197
  67. data/tests/fixtures/fail18.json +1 -0
  68. data/tests/test_json.rb +181 -22
  69. data/tests/test_json_addition.rb +84 -16
  70. data/tests/test_json_encoding.rb +68 -0
  71. data/tests/test_json_fixtures.rb +9 -5
  72. data/tests/test_json_generate.rb +114 -14
  73. data/tests/test_json_rails.rb +144 -0
  74. data/tests/test_json_unicode.rb +35 -14
  75. data/tools/fuzz.rb +13 -7
  76. data/tools/server.rb +0 -1
  77. metadata +156 -122
  78. data/benchmarks/benchmark.txt +0 -133
  79. data/benchmarks/benchmark_generator.rb +0 -44
  80. data/benchmarks/benchmark_parser.rb +0 -22
  81. data/benchmarks/benchmark_rails.rb +0 -26
  82. data/ext/json/ext/generator/Makefile +0 -149
  83. data/ext/json/ext/generator/unicode.c +0 -184
  84. data/ext/json/ext/generator/unicode.h +0 -40
  85. data/ext/json/ext/parser/Makefile +0 -149
  86. data/ext/json/ext/parser/unicode.c +0 -156
  87. data/ext/json/ext/parser/unicode.h +0 -44
  88. data/tests/fixtures/pass18.json +0 -1
  89. data/tests/runner.rb +0 -24
  90. /data/tests/fixtures/{fail15.json → pass15.json} +0 -0
  91. /data/tests/fixtures/{fail16.json → pass16.json} +0 -0
  92. /data/tests/fixtures/{fail17.json → pass17.json} +0 -0
  93. /data/tests/fixtures/{fail26.json → pass26.json} +0 -0
metadata CHANGED
@@ -1,146 +1,180 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.2
3
- specification_version: 1
4
2
  name: json_pure
5
3
  version: !ruby/object:Gem::Version
6
- version: 1.0.0
7
- date: 2007-03-27 00:00:00 +02:00
8
- summary: A JSON implementation in Ruby
9
- require_paths:
10
- - lib
11
- email: flori@ping.de
12
- homepage: http://json.rubyforge.org
13
- rubyforge_project: json
14
- description: ""
15
- autorequire:
16
- default_executable: edit_json.rb
17
- bindir: bin
18
- has_rdoc: true
19
- required_ruby_version: !ruby/object:Gem::Version::Requirement
20
- requirements:
21
- - - ">"
22
- - !ruby/object:Gem::Version
23
- version: 0.0.0
24
- version:
4
+ version: 1.4.6
25
5
  platform: ruby
26
- signing_key:
27
- cert_chain:
28
- post_install_message:
29
6
  authors:
30
7
  - Florian Frank
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2010-08-09 00:00:00 +02:00
13
+ default_executable: edit_json.rb
14
+ dependencies: []
15
+
16
+ description: This is a JSON implementation in pure Ruby.
17
+ email: flori@ping.de
18
+ executables:
19
+ - edit_json.rb
20
+ - prettify_json.rb
21
+ extensions: []
22
+
23
+ extra_rdoc_files:
24
+ - README
31
25
  files:
32
- - bin
26
+ - CHANGES
27
+ - bin/edit_json.rb
28
+ - bin/prettify_json.rb
33
29
  - VERSION
34
- - TODO
35
- - tests
36
30
  - GPL
37
- - install.rb
38
- - ext
39
- - diagrams
40
- - benchmarks
41
- - Rakefile
42
- - data
43
- - lib
31
+ - TODO
44
32
  - README
45
- - tools
46
- - CHANGES
47
- - bin/edit_json.rb
48
- - tests/test_json_fixtures.rb
49
- - tests/runner.rb
50
- - tests/test_json.rb
51
- - tests/fixtures
52
- - tests/test_json_unicode.rb
53
- - tests/test_json_generate.rb
54
- - tests/test_json_addition.rb
55
- - tests/fixtures/fail27.json
56
- - tests/fixtures/fail22.json
57
- - tests/fixtures/fail26.json
58
- - tests/fixtures/fail16.json
59
- - tests/fixtures/fail28.json
60
- - tests/fixtures/fail25.json
61
- - tests/fixtures/pass18.json
62
- - tests/fixtures/fail9.json
63
- - tests/fixtures/fail20.json
64
- - tests/fixtures/fail24.json
65
- - tests/fixtures/fail14.json
66
- - tests/fixtures/fail4.json
67
- - tests/fixtures/fail7.json
68
- - tests/fixtures/fail10.json
69
- - tests/fixtures/fail13.json
70
- - tests/fixtures/fail6.json
71
- - tests/fixtures/fail21.json
72
- - tests/fixtures/fail23.json
73
- - tests/fixtures/fail3.json
74
- - tests/fixtures/fail1.json
75
- - tests/fixtures/fail11.json
76
- - tests/fixtures/fail5.json
77
- - tests/fixtures/pass1.json
78
- - tests/fixtures/fail12.json
79
- - tests/fixtures/fail15.json
80
- - tests/fixtures/pass3.json
81
- - tests/fixtures/fail8.json
82
- - tests/fixtures/fail17.json
83
- - tests/fixtures/fail19.json
84
- - tests/fixtures/pass2.json
85
- - tests/fixtures/fail2.json
86
- - ext/json
87
- - ext/json/ext
88
- - ext/json/ext/generator
89
- - ext/json/ext/parser
90
- - ext/json/ext/generator/Makefile
91
- - ext/json/ext/generator/unicode.c
92
- - ext/json/ext/generator/unicode.h
33
+ - benchmarks/ohai.json
34
+ - benchmarks/parser_benchmark.rb
35
+ - benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure.log
36
+ - benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkComparison.log
37
+ - benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser.dat
38
+ - benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe.dat
39
+ - benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser.dat
40
+ - benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast.dat
41
+ - benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast-autocorrelation.dat
42
+ - benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure.log
43
+ - benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser-autocorrelation.dat
44
+ - benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator-autocorrelation.dat
45
+ - benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt.log
46
+ - benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast-autocorrelation.dat
47
+ - benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast.dat
48
+ - benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser.dat
49
+ - benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty-autocorrelation.dat
50
+ - benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser-autocorrelation.dat
51
+ - benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty.dat
52
+ - benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails.log
53
+ - benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt.log
54
+ - benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails.log
55
+ - benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkComparison.log
56
+ - benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe.dat
57
+ - benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator.dat
58
+ - benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe-autocorrelation.dat
59
+ - benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty.dat
60
+ - benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML.log
61
+ - benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser-autocorrelation.dat
62
+ - benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty-autocorrelation.dat
63
+ - benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser-autocorrelation.dat
64
+ - benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser.dat
65
+ - benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe-autocorrelation.dat
66
+ - benchmarks/generator2_benchmark.rb
67
+ - benchmarks/generator_benchmark.rb
68
+ - benchmarks/parser2_benchmark.rb
69
+ - benchmarks/ohai.ruby
93
70
  - ext/json/ext/generator/extconf.rb
94
71
  - ext/json/ext/generator/generator.c
95
- - ext/json/ext/parser/Makefile
96
- - ext/json/ext/parser/parser.c
97
- - ext/json/ext/parser/unicode.c
98
- - ext/json/ext/parser/parser.rl
99
- - ext/json/ext/parser/unicode.h
72
+ - ext/json/ext/generator/generator.h
100
73
  - ext/json/ext/parser/extconf.rb
101
- - benchmarks/benchmark_generator.rb
102
- - benchmarks/benchmark.txt
103
- - benchmarks/benchmark_parser.rb
104
- - benchmarks/benchmark_rails.rb
105
- - data/example.json
106
- - data/prototype.js
107
- - data/index.html
108
- - lib/json
74
+ - ext/json/ext/parser/parser.rl
75
+ - ext/json/ext/parser/parser.h
76
+ - ext/json/ext/parser/parser.c
77
+ - Rakefile
78
+ - tools/fuzz.rb
79
+ - tools/server.rb
109
80
  - lib/json.rb
110
- - lib/json/FalseClass.xpm
111
- - lib/json/TrueClass.xpm
112
- - lib/json/ext.rb
113
- - lib/json/common.rb
114
- - lib/json/Hash.xpm
115
- - lib/json/pure
81
+ - lib/json/json.xpm
116
82
  - lib/json/Key.xpm
83
+ - lib/json/String.xpm
117
84
  - lib/json/Numeric.xpm
85
+ - lib/json/Hash.xpm
86
+ - lib/json/add/rails.rb
87
+ - lib/json/add/core.rb
88
+ - lib/json/common.rb
118
89
  - lib/json/Array.xpm
119
- - lib/json/editor.rb
120
- - lib/json/String.xpm
90
+ - lib/json/FalseClass.xpm
91
+ - lib/json/pure/generator.rb
92
+ - lib/json/pure/parser.rb
93
+ - lib/json/TrueClass.xpm
121
94
  - lib/json/pure.rb
122
- - lib/json/NilClass.xpm
123
95
  - lib/json/version.rb
124
- - lib/json/json.xpm
125
- - lib/json/pure/parser.rb
126
- - lib/json/pure/generator.rb
127
- - tools/server.rb
128
- - tools/fuzz.rb
129
- test_files:
130
- - tests/runner.rb
96
+ - lib/json/ext.rb
97
+ - lib/json/editor.rb
98
+ - lib/json/NilClass.xpm
99
+ - data/example.json
100
+ - data/index.html
101
+ - data/prototype.js
102
+ - tests/test_json_encoding.rb
103
+ - tests/test_json_addition.rb
104
+ - tests/fixtures/pass16.json
105
+ - tests/fixtures/fail4.json
106
+ - tests/fixtures/fail1.json
107
+ - tests/fixtures/fail28.json
108
+ - tests/fixtures/fail8.json
109
+ - tests/fixtures/fail19.json
110
+ - tests/fixtures/pass2.json
111
+ - tests/fixtures/pass26.json
112
+ - tests/fixtures/pass1.json
113
+ - tests/fixtures/fail3.json
114
+ - tests/fixtures/fail20.json
115
+ - tests/fixtures/pass3.json
116
+ - tests/fixtures/pass15.json
117
+ - tests/fixtures/fail12.json
118
+ - tests/fixtures/fail13.json
119
+ - tests/fixtures/fail22.json
120
+ - tests/fixtures/fail24.json
121
+ - tests/fixtures/fail9.json
122
+ - tests/fixtures/fail2.json
123
+ - tests/fixtures/fail14.json
124
+ - tests/fixtures/fail6.json
125
+ - tests/fixtures/fail21.json
126
+ - tests/fixtures/fail7.json
127
+ - tests/fixtures/pass17.json
128
+ - tests/fixtures/fail11.json
129
+ - tests/fixtures/fail25.json
130
+ - tests/fixtures/fail5.json
131
+ - tests/fixtures/fail18.json
132
+ - tests/fixtures/fail27.json
133
+ - tests/fixtures/fail10.json
134
+ - tests/fixtures/fail23.json
135
+ - tests/test_json_rails.rb
136
+ - tests/test_json.rb
137
+ - tests/test_json_generate.rb
138
+ - tests/test_json_unicode.rb
139
+ - tests/test_json_fixtures.rb
140
+ - COPYING
141
+ - install.rb
142
+ has_rdoc: true
143
+ homepage: http://flori.github.com/json
144
+ licenses: []
145
+
146
+ post_install_message:
131
147
  rdoc_options:
132
148
  - --title
133
- - JSON -- A JSON implemention
149
+ - JSON implemention for ruby
134
150
  - --main
135
- - JSON
136
- - --line-numbers
137
- extra_rdoc_files: []
138
-
139
- executables:
140
- - edit_json.rb
141
- extensions: []
142
-
151
+ - README
152
+ require_paths:
153
+ - lib
154
+ required_ruby_version: !ruby/object:Gem::Requirement
155
+ requirements:
156
+ - - ">="
157
+ - !ruby/object:Gem::Version
158
+ version: "0"
159
+ version:
160
+ required_rubygems_version: !ruby/object:Gem::Requirement
161
+ requirements:
162
+ - - ">="
163
+ - !ruby/object:Gem::Version
164
+ version: "0"
165
+ version:
143
166
  requirements: []
144
167
 
145
- dependencies: []
146
-
168
+ rubyforge_project: json
169
+ rubygems_version: 1.3.5
170
+ signing_key:
171
+ specification_version: 3
172
+ summary: JSON Implementation for Ruby
173
+ test_files:
174
+ - tests/test_json_encoding.rb
175
+ - tests/test_json_addition.rb
176
+ - tests/test_json_rails.rb
177
+ - tests/test_json.rb
178
+ - tests/test_json_generate.rb
179
+ - tests/test_json_unicode.rb
180
+ - tests/test_json_fixtures.rb
@@ -1,133 +0,0 @@
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
-
@@ -1,44 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'bullshit'
4
- $KCODE='utf8'
5
- require 'json'
6
-
7
- class BC_Generator < Bullshit::TimeCase
8
- include JSON
9
-
10
- warmup true
11
- duration 10
12
-
13
- def setup
14
- a = [ nil, false, true, "fÖßÄr", [ "n€st€d", true ], { "fooß" => "bär", "quux" => true } ]
15
- puts JSON[a]
16
- @big = a * 100
17
- end
18
-
19
- def benchmark_generator_fast
20
- @result = JSON.fast_generate(@big)
21
- end
22
-
23
- def reset_benchmark_generator_fast
24
- @result and @result.size > 2 + 6 * @big.size or raise @result.to_s
25
- end
26
-
27
- def benchmark_generator_safe
28
- @result = JSON.generate(@big)
29
- end
30
-
31
- def reset_benchmark_generator_safe
32
- @result and @result.size > 2 + 6 * @big.size or raise @result.to_s
33
- end
34
-
35
- def benchmark_generator_pretty
36
- @result = JSON.pretty_generate(@big)
37
- end
38
-
39
- def reset_benchmark_generator_pretty
40
- @result and @result.size > 2 + 6 * @big.size or raise @result.to_s
41
- end
42
-
43
- compare :generator_fast, :generator_safe, :generator_pretty
44
- end
@@ -1,22 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'bullshit'
4
- require 'json'
5
-
6
- class BC_Parser < Bullshit::TimeCase
7
- include JSON
8
-
9
- warmup true
10
- duration 10
11
-
12
- def setup
13
- a = [ nil, false, true, "fÖßÄr", [ "n€st€d", true ], { "fooß" => "bär", "quux" => true } ]
14
- @big = a * 100
15
- @json = JSON.generate(@big)
16
- end
17
-
18
- def benchmark_parser
19
- a = JSON.parse(@json)
20
- a == @big or raise "not equal"
21
- end
22
- end
@@ -1,26 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'bullshit'
4
- require 'active_support'
5
-
6
- class BC_Rails < Bullshit::TimeCase
7
- warmup true
8
- duration 10
9
-
10
- def setup
11
- a = [ nil, false, true, "fÖßÄr", [ "n€st€d", true ], { "fooß" => "bär", "quux" => true } ]
12
- puts a.to_json
13
- @big = a * 100
14
- end
15
-
16
- def benchmark_generator
17
- @result = @big.to_json
18
- end
19
-
20
- def reset_benchmark_generator
21
- @result and @result.size > 2 + 6 * @big.size or raise @result.to_s
22
- if stack = Thread.current[:json_reference_stack]
23
- stack.clear
24
- end
25
- end
26
- end
@@ -1,149 +0,0 @@
1
-
2
- SHELL = /bin/sh
3
-
4
- #### Start of system configuration section. ####
5
-
6
- srcdir = .
7
- topdir = /usr/lib/ruby/1.8/i686-linux
8
- hdrdir = $(topdir)
9
- VPATH = $(srcdir):$(topdir):$(hdrdir)
10
- prefix = $(DESTDIR)/usr
11
- exec_prefix = $(prefix)
12
- sitedir = $(DESTDIR)/usr/lib/ruby/site_ruby
13
- rubylibdir = $(libdir)/ruby/$(ruby_version)
14
- docdir = $(datarootdir)/doc/$(PACKAGE)
15
- dvidir = $(docdir)
16
- datarootdir = $(prefix)/share
17
- archdir = $(rubylibdir)/$(arch)
18
- sbindir = $(exec_prefix)/sbin
19
- psdir = $(docdir)
20
- localedir = $(datarootdir)/locale
21
- htmldir = $(docdir)
22
- datadir = $(DESTDIR)/usr/share
23
- includedir = $(prefix)/include
24
- infodir = $(DESTDIR)/usr/share/info
25
- sysconfdir = $(DESTDIR)/etc
26
- mandir = $(DESTDIR)/usr/share/man
27
- libdir = $(exec_prefix)/lib
28
- sharedstatedir = $(prefix)/com
29
- oldincludedir = $(DESTDIR)/usr/include
30
- pdfdir = $(docdir)
31
- sitearchdir = $(sitelibdir)/$(sitearch)
32
- bindir = $(exec_prefix)/bin
33
- localstatedir = $(DESTDIR)/var/lib
34
- sitelibdir = $(sitedir)/$(ruby_version)
35
- libexecdir = $(exec_prefix)/libexec
36
-
37
- CC = i686-pc-linux-gnu-gcc -Wall -ggdb
38
- LIBRUBY = $(LIBRUBY_SO)
39
- LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
40
- LIBRUBYARG_SHARED = -Wl,-R -Wl,$(libdir) -L$(libdir) -L. -l$(RUBY_SO_NAME)
41
- LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static
42
-
43
- RUBY_EXTCONF_H =
44
- CFLAGS = -fPIC -march=pentium4 -O2 -pipe -ggdb -fPIC
45
- INCFLAGS = -I. -I$(topdir) -I$(hdrdir) -I$(srcdir)
46
- CPPFLAGS =
47
- CXXFLAGS = $(CFLAGS)
48
- DLDFLAGS =
49
- LDSHARED = $(CC) -shared
50
- AR = i686-pc-linux-gnu-ar
51
- EXEEXT =
52
-
53
- RUBY_INSTALL_NAME = ruby18
54
- RUBY_SO_NAME = ruby18
55
- arch = i686-linux
56
- sitearch = i686-linux
57
- ruby_version = 1.8
58
- ruby = /usr/bin/ruby18
59
- RUBY = $(ruby)
60
- RM = rm -f
61
- MAKEDIRS = mkdir -p
62
- INSTALL = /bin/install -c
63
- INSTALL_PROG = $(INSTALL) -m 0755
64
- INSTALL_DATA = $(INSTALL) -m 644
65
- COPY = cp
66
-
67
- #### End of system configuration section. ####
68
-
69
- preload =
70
-
71
- libpath = $(libdir)
72
- LIBPATH = -L'$(libdir)' -Wl,-R'$(libdir)'
73
- DEFFILE =
74
-
75
- CLEANFILES =
76
- DISTCLEANFILES =
77
-
78
- extout =
79
- extout_prefix =
80
- target_prefix =
81
- LOCAL_LIBS =
82
- LIBS = $(LIBRUBYARG_SHARED) -ldl -lcrypt -lm -lc
83
- SRCS = unicode.c generator.c
84
- OBJS = unicode.o generator.o
85
- TARGET = generator
86
- DLLIB = $(TARGET).so
87
- EXTSTATIC =
88
- STATIC_LIB =
89
-
90
- RUBYCOMMONDIR = $(sitedir)$(target_prefix)
91
- RUBYLIBDIR = $(sitelibdir)$(target_prefix)
92
- RUBYARCHDIR = $(sitearchdir)$(target_prefix)
93
-
94
- TARGET_SO = $(DLLIB)
95
- CLEANLIBS = $(TARGET).so $(TARGET).il? $(TARGET).tds $(TARGET).map
96
- CLEANOBJS = *.o *.a *.s[ol] *.pdb *.exp *.bak
97
-
98
- all: $(DLLIB)
99
- static: $(STATIC_LIB)
100
-
101
- clean:
102
- @-$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES)
103
-
104
- distclean: clean
105
- @-$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
106
- @-$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
107
-
108
- realclean: distclean
109
- install: install-so install-rb
110
-
111
- install-so: $(RUBYARCHDIR)
112
- install-so: $(RUBYARCHDIR)/$(DLLIB)
113
- $(RUBYARCHDIR)/$(DLLIB): $(DLLIB)
114
- $(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
115
- install-rb: pre-install-rb install-rb-default
116
- install-rb-default: pre-install-rb-default
117
- pre-install-rb: Makefile
118
- pre-install-rb-default: Makefile
119
- $(RUBYARCHDIR):
120
- $(MAKEDIRS) $@
121
-
122
- site-install: site-install-so site-install-rb
123
- site-install-so: install-so
124
- site-install-rb: install-rb
125
-
126
- .SUFFIXES: .c .m .cc .cxx .cpp .C .o
127
-
128
- .cc.o:
129
- $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
130
-
131
- .cxx.o:
132
- $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
133
-
134
- .cpp.o:
135
- $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
136
-
137
- .C.o:
138
- $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
139
-
140
- .c.o:
141
- $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) -c $<
142
-
143
- $(DLLIB): $(OBJS)
144
- @-$(RM) $@
145
- $(LDSHARED) $(DLDFLAGS) $(LIBPATH) -o $@ $(OBJS) $(LOCAL_LIBS) $(LIBS)
146
-
147
-
148
-
149
- $(OBJS): ruby.h defines.h