summaryrefslogtreecommitdiff
path: root/java/src/json/ext/Parser.java
diff options
context:
space:
mode:
authorWatson <watson1978@gmail.com>2018-03-03 01:16:34 +0900
committerFlorian Frank <flori@ping.de>2019-04-29 15:58:28 +0200
commitc34d01ff6a18dac04a90b2e0f820cdb1d5c7e1b2 (patch)
treef6f9404c1316a696881435a27fcf3f0c3f46155d /java/src/json/ext/Parser.java
parent9ae6d2969cb1e3b927897806e5b632cb2912a0b6 (diff)
downloadjson-c34d01ff6a18dac04a90b2e0f820cdb1d5c7e1b2.tar.gz
Convert string encoding to UTF-8 only when needed
## 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 ```
Diffstat (limited to 'java/src/json/ext/Parser.java')
0 files changed, 0 insertions, 0 deletions