Sha256: dc33853090b8393a89eb8319da0e33b6acc9dd108f0e5d9b3a6f12352c39eee7

Contents?: true

Size: 1.2 KB

Versions: 2

Compression:

Stored size: 1.2 KB

Contents

# frozen_string_literal: true

require_relative "benchmarking_support"
require_relative "app"

Benchmark.run("ObjectWriter_OneProperty_PushValue") do
  writer = Panko::ObjectWriter.new

  writer.push_object
  writer.push_value "value1", "key1"
  writer.pop

  writer.output
end

Benchmark.run("ObjectWriter_TwoProperty_PushValue") do
  writer = Panko::ObjectWriter.new

  writer.push_object
  writer.push_value "value1", "key1"
  writer.push_value "value2", "key2"
  writer.pop

  writer.output
end

Benchmark.run("ObjectWriter_OneProperty_PushValuePushKey") do
  writer = Panko::ObjectWriter.new

  writer.push_object
  writer.push_key "key1"
  writer.push_value "value1"
  writer.pop

  writer.output
end

Benchmark.run("ObjectWriter_TwoProperty_PushValuePushKey") do
  writer = Panko::ObjectWriter.new

  writer.push_object
  writer.push_key "key1"
  writer.push_value "value1"

  writer.push_key "key2"
  writer.push_value "value2"
  writer.pop

  writer.output
end

Benchmark.run("ObjectWriter_NestedObject") do
  writer = Panko::ObjectWriter.new

  writer.push_object
  writer.push_value "value1", "key1"

  writer.push_object "key2"
  writer.push_value "value2", "key2"
  writer.pop

  writer.pop

  writer.output
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
panko_serializer-0.8.2 benchmarks/bm_object_writer.rb
panko_serializer-0.8.1 benchmarks/bm_object_writer.rb