1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/ext/json
Watson 98a9445db9
[flori/json] Add shortcut converting to String
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
```

https://github.com/flori/json/commit/38c0f6dbe4
2019-10-14 19:54:49 +09:00
..
fbuffer Merge json-2.0.4. 2017-04-12 00:21:18 +00:00
generator [flori/json] Add shortcut converting to String 2019-10-14 19:54:49 +09:00
lib [flori/json] Pass args all #to_json in json/add/*. 2019-10-14 19:54:48 +09:00
parser [flori/json] Only attempt to resize strings not other objects 2019-10-14 19:54:48 +09:00
depend Added depend files 2019-07-14 01:31:29 +09:00
extconf.rb * ext/json/**/*.rb: merge original files from upstream repository. 2016-07-14 03:48:54 +00:00
json.gemspec Removed useless freezes from gemspec files 2019-07-13 07:25:54 +09:00