summaryrefslogtreecommitdiff
path: root/lib/ffi_yajl/benchmark/encode_json_and_marshal.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ffi_yajl/benchmark/encode_json_and_marshal.rb')
-rw-r--r--lib/ffi_yajl/benchmark/encode_json_and_marshal.rb28
1 files changed, 14 insertions, 14 deletions
diff --git a/lib/ffi_yajl/benchmark/encode_json_and_marshal.rb b/lib/ffi_yajl/benchmark/encode_json_and_marshal.rb
index 73a7d0c..e9d19bc 100644
--- a/lib/ffi_yajl/benchmark/encode_json_and_marshal.rb
+++ b/lib/ffi_yajl/benchmark/encode_json_and_marshal.rb
@@ -17,26 +17,26 @@ hash = Yajl::Parser.new.parse(json)
json.close
puts "Starting benchmark encoding #{filename} #{times} times\n\n"
-Benchmark.bmbm { |x|
+Benchmark.bmbm do |x|
encoder = Yajl::Encoder.new
- x.report {
+ x.report do
puts "Yajl::Encoder#encode"
- times.times {
+ times.times do
encoder.encode(hash, StringIO.new)
- }
- }
+ end
+ end
if defined?(JSON)
- x.report {
+ x.report do
puts "JSON's #to_json"
- times.times {
+ times.times do
JSON.generate(hash)
- }
- }
+ end
+ end
end
- x.report {
+ x.report do
puts "Marshal.dump"
- times.times {
+ times.times do
Marshal.dump(hash)
- }
- }
-}
+ end
+ end
+end