diff options
Diffstat (limited to 'lib/ffi_yajl/benchmark/parse_stream.rb')
-rw-r--r-- | lib/ffi_yajl/benchmark/parse_stream.rb | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/ffi_yajl/benchmark/parse_stream.rb b/lib/ffi_yajl/benchmark/parse_stream.rb index 679eb92..d689a3d 100644 --- a/lib/ffi_yajl/benchmark/parse_stream.rb +++ b/lib/ffi_yajl/benchmark/parse_stream.rb @@ -1,26 +1,26 @@ -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/..') -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib') +$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + "/..") +$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + "/../lib") -require 'rubygems' -require 'benchmark' -require 'yajl' +require "rubygems" +require "benchmark" +require "yajl" begin - require 'json' + require "json" rescue LoadError end begin - require 'active_support' + require "active_support" rescue LoadError end -filename = 'benchmark/subjects/twitter_stream.json' -json = File.new(filename, 'r') +filename = "benchmark/subjects/twitter_stream.json" +json = File.new(filename, "r") times = ARGV[0] ? ARGV[0].to_i : 100 puts "Starting benchmark parsing JSON stream (#{File.size(filename)} bytes of JSON data with 430 JSON separate strings) #{times} times\n\n" Benchmark.bmbm do |x| parser = Yajl::Parser.new - parser.on_parse_complete = ->(obj) {} + parser.on_parse_complete = ->(_obj) {} x.report do puts "Yajl::Parser#parse" times.times do |