File tree Expand file tree Collapse file tree 2 files changed +7
-0
lines changed
Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change 1515
1616def benchmark_parsing ( name , json_output )
1717 puts "== Parsing #{ name } (#{ json_output . size } bytes)"
18+ coder = JSON ::Coder . new
1819
1920 Benchmark . ips do |x |
2021 x . report ( "json" ) { JSON . parse ( json_output ) } if RUN [ :json ]
22+ x . report ( "json_coder" ) { coder . load ( json_output ) } if RUN [ :json_coder ]
2123 x . report ( "oj" ) { Oj . load ( json_output ) } if RUN [ :oj ]
2224 x . report ( "Oj::Parser" ) { Oj ::Parser . new ( :usual ) . parse ( json_output ) } if RUN [ :oj ]
2325 x . report ( "rapidjson" ) { RapidJSON . parse ( json_output ) } if RUN [ :rapidjson ]
Original file line number Diff line number Diff line change @@ -848,11 +848,16 @@ def initialize(options = nil, &as_json)
848848 end
849849 options [ :as_json ] = as_json if as_json
850850 @state = State . new ( options )
851+ @parser_config = Ext ::Parser ::Config . new ( options )
851852 end
852853
853854 def dump ( ...)
854855 @state . generate ( ...)
855856 end
857+
858+ def load ( source )
859+ @parser_config . parse ( source )
860+ end
856861 end
857862end
858863
You can’t perform that action at this time.
0 commit comments