summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
| | * | fix link in travis widgetJoe Francis2017-10-091-2/+3
| |/ /
* | | Does not check whether illegal utf-8 if string has ascii only.Watson2019-04-291-8/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ## Before ``` $ ruby bench_json_generate.rb Warming up -------------------------------------- json 25.000 i/100ms Calculating ------------------------------------- json 250.478 (± 4.8%) i/s - 1.250k in 5.002238s ``` ## After ``` $ ruby bench_json_generate.rb Warming up -------------------------------------- json 32.000 i/100ms Calculating ------------------------------------- json 360.652 (± 3.6%) i/s - 1.824k in 5.064511s ``` ## Test code ``` require 'json' require 'benchmark/ips' obj = [] 1000.times do |i| obj << { :string => "x" * 100, :utf8 => "あ" * 100 } end Benchmark.ips do |x| x.report "json" do |iter| count = 0 while count < iter JSON.generate(obj) count += 1 end end end ```
* | | Convert string encoding to UTF-8 only when neededWatson2019-04-291-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ## Before ``` $ ruby bench_json_generate.rb Warming up -------------------------------------- json 129.000 i/100ms Calculating ------------------------------------- json 1.300k (± 2.3%) i/s - 6.579k in 5.064656s ``` ## After ``` $ ruby bench_json_generate.rb Warming up -------------------------------------- json 189.000 i/100ms Calculating ------------------------------------- json 1.964k (± 3.3%) i/s - 9.828k in 5.011237s ``` ## Code ``` require 'json' require 'benchmark/ips' obj = [] 1000.times do |i| obj << { "id" => i, :age => 42, } end Benchmark.ips do |x| x.report "json" do |iter| count = 0 while count < iter JSON.generate(obj) count += 1 end end end ```
* | | Convert String encoding using `rb_str_encode()`Watson2019-04-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `rb_funcall` might be slightly heavy to call the Ruby method. This patch will convert String encoding using `rb_str_encode()` instead of `rb_funcall()`. ## Before ``` $ ruby bench_json_generate.rb Warming up -------------------------------------- json 78.000 i/100ms Calculating ------------------------------------- json 789.781 (± 2.7%) i/s - 3.978k in 5.041043s ``` ## After ``` $ ruby bench_json_generate.rb Warming up -------------------------------------- json 129.000 i/100ms Calculating ------------------------------------- json 1.300k (± 2.3%) i/s - 6.579k in 5.064656s ``` ## Code ``` require 'json' require 'benchmark/ips' obj = [] 1000.times do |i| obj << { "id" => i, :age => 42, } end Benchmark.ips do |x| x.report "json" do |iter| count = 0 while count < iter JSON.generate(obj) count += 1 end end end ```
* | | Add shortcut converting to StringWatson2019-04-291-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In where to convert Hash key to String for json, this patch will add shortcut for String/Symbol in Hash key. ``` $ ruby bench_json_generate.rb Warming up -------------------------------------- json 65.000 i/100ms Calculating ------------------------------------- json 659.576 (± 1.5%) i/s - 3.315k in 5.027127s ``` ``` $ ruby bench_json_generate.rb Warming up -------------------------------------- json 78.000 i/100ms Calculating ------------------------------------- json 789.781 (± 2.7%) i/s - 3.978k in 5.041043s ``` ``` require 'json' require 'benchmark/ips' obj = [] 1000.times do |i| obj << { "id" => i, :age => 42, } end Benchmark.ips do |x| x.report "json" do |iter| count = 0 while count < iter JSON.generate(obj) count += 1 end end end ```
* | | Convert Hash object using rb_hash_foreach()Watson2019-04-291-22/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To convert Hash convert, this part was using following pseudo code ``` obj.keys.each do |key| value = obj[key] ... end ``` and `rb_funcall()` was called for `obj.keys`. It might be slightly heavy to call the Ruby method. This patch will iterate to convert Hash object about key/value using `rb_hash_foreach()` Ruby API instead of `rb_funcall()`. ``` $ ruby bench_json_generate.rb Warming up -------------------------------------- json 55.000 i/100ms Calculating ------------------------------------- json 558.501 (± 1.1%) i/s - 2.805k in 5.022986s ``` ``` $ ruby bench_json_generate.rb Warming up -------------------------------------- json 65.000 i/100ms Calculating ------------------------------------- json 659.576 (± 1.5%) i/s - 3.315k in 5.027127s ``` ``` require 'json' require 'benchmark/ips' obj = [] 1000.times do |i| obj << { "id" => i, :age => 42, } end Benchmark.ips do |x| x.report "json" do |iter| count = 0 while count < iter JSON.generate(obj) count += 1 end end end ```
* | | Only attempt to resize strings not other objectsFlorian Frank2019-04-292-2/+2
| | |
* | | Test on newer rubiesFlorian Frank2019-03-141-2/+4
| | |
* | | fix test as reported in #343Florian Frank2017-12-211-1/+1
|/ /
* | Allow failing 1.9.3 on travisFlorian Frank2017-10-041-0/+1
| |
* | JSON marshalling support for Set and SortedSetJosh Kline2017-10-042-0/+39
| |
* | Merge pull request #332 from perlun/patch-3Florian Frank2017-10-041-0/+12
|\ \ | | | | | | README: Added note about json/add/exception
| * | README: Added note about json/add/exceptionPer Lundberg2017-06-011-0/+12
| | |
* | | Merge branch 'master' of github.com:flori/jsonFlorian Frank2017-06-211-0/+1
|\ \ \
| * \ \ Merge pull request #335 from hsbt/added-bigdecimalFlorian Frank2017-06-211-0/+1
| |\ \ \ | | |/ / | |/| | Added missing bigdecimal for its test
| | * | Added missing bigdecimal for its testSHIBATA Hiroshi2017-06-161-0/+1
| |/ /
* | | Merge branch 'master' of storage.gate.ping.de:/git/jsonFlorian Frank2017-06-211-17/+21
|\ \ \ | |/ /
| * | Merge pull request #330 from perlun/patch-1Florian Frank2017-05-311-17/+21
| |\ \ | | | | | | | | README: Fixed code examples to start in the left-most column
| | * \ Merge branch 'master' into patch-1Florian Frank2017-05-311-0/+4
| | |\ \ | | |/ / | |/| |
| * | | Merge pull request #331 from perlun/patch-2Florian Frank2017-05-311-1/+1
| |\ \ \ | | | | | | | | | | Fixed json_create example to use create_additions = true
| | * | | Fixed json_create example to use create_additions = truePer Lundberg2017-05-311-1/+1
| |/ / / | | | | | | | | | | | | | | | | The example doesn't work OOTB, since this flag is _not enabled_ by default. (Even with this change in place, I cannot get additions to work with the `Range` class. For custom objects it works though, I tested with the example from the `json_addition_test.rb` - that's where I got the working approach.)
| | * | README: Fixed code examples to start in the left-most columnPer Lundberg2017-05-311-17/+17
| |/ / | | | | | | I feel that it's more natural this way. What do you think, do you prefer the current style?
* | | simplecov breaks testing => removedFlorian Frank2017-06-214-7/+1
|/ /
* | Moving json java gemspec from here to therev2.1.0Florian Frank2017-04-182-1/+1
| |
* | Merge branch 'fix_jruby_gemspec_bug' of https://github.com/xb/jsonFlorian Frank2017-04-183-7/+3
|\ \
| * | Back-out change of directory of json-java.gemspec.Xuân Baldauf2017-03-273-7/+3
| | |
* | | Use assert_raiseFlorian Frank2017-04-181-2/+2
| | |
* | | newest versionFlorian Frank2017-04-182-1/+1
| | |
* | | Test the new feature and fix problemsFlorian Frank2017-04-186-34/+47
| | | | | | | | | | | | | | | | | | - Initialize i_new - Add to changes - Test on ruby 2.4.1
* | | Merge branch 'test_bigdecimal_parsing' of https://github.com/xb/jsonFlorian Frank2017-04-181-0/+5
|\ \ \
| * | | Actually test BigDecimal parsing.Xuân Baldauf2017-03-191-0/+5
| |/ /
* | | New gemspecsFlorian Frank2017-04-182-2/+2
| | |
* | | Raise exceptionFlorian Frank2017-04-185-23/+41
| | | | | | | | | | | | for incomplete unicode surrogates/character escape sequences
* | | Fix arbitrary heap exposure problemFlorian Frank2017-04-182-7/+6
|/ /
* | Remove unused macroFlorian Frank2017-01-221-3/+0
| |
* | Let's not get ahead of ourselvesFlorian Frank2017-01-121-1/+0
| |
* | Support some older internal Ruby API (<2.0)Florian Frank2017-01-126-1149/+1309
| |
* | Merge pull request #306 from perlun/patch-1Florian Frank2016-11-291-1/+1
|\ \ | | | | | | CHANGES.md: Fixed typo
| * | Fixed typoPer Lundberg2016-11-041-1/+1
| | |
* | | Use newest rubygemsFlorian Frank2016-11-222-2/+2
| | |
* | | Test newer rubiesFlorian Frank2016-11-221-3/+2
|/ /
* | Merge decimal_class patch by Michael JaschobFlorian Frank2016-09-2315-1410/+1327
| | | | | | | | | | | | Also: - Avoid some issues with bundler - Avoid some issues with jruby
* | Ignore byebug_historyFlorian Frank2016-09-231-0/+1
| |
* | Simplify JAVA_HOME codeFlorian Frank2016-09-231-7/+5
| |
* | Avoid buggy bundlerFlorian Frank2016-09-121-0/+1
| |
* | Test ruby 2.4.0-preview2Florian Frank2016-09-123-2/+3
| |
* | Merge branch 'master' of github.com:flori/jsonFlorian Frank2016-09-091-1/+1
|\ \
| * \ Merge pull request #301 from kyanagi/fix_openstruct_json_create_docFlorian Frank2016-09-091-1/+1
| |\ \ | | | | | | | | Correct documentation of OpenStruct.json_create
| | * | Correct documentation of OpenStruct.json_createKouhei Yanagita2016-08-301-1/+1
| |/ /
* | | New gemspecFlorian Frank2016-09-092-1/+1
| | |