diff options
| author | Watson <watson1978@gmail.com> | 2018-03-04 23:34:26 +0900 |
|---|---|---|
| committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-10-14 19:54:48 +0900 |
| commit | 641136c4af89ec2bc1f2c80aeefc7a38f3bc48df (patch) | |
| tree | 66c09141827b90f62c6a82acee621a395f29efde /spec | |
| parent | d9e50fcbeb34534d065f3662b6b952bc57994b43 (diff) | |
[flori/json] Does not check whether illegal utf-8 if string has ascii only.
## 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
```
https://github.com/flori/json/commit/91a24ecac3
Diffstat (limited to 'spec')
0 files changed, 0 insertions, 0 deletions
