Sha256: a74d1584bc1447c75ddd6d15289be27e1352ed3beeae1c455bcf01777fc482b6

Contents?: true

Size: 658 Bytes

Versions: 37

Compression:

Stored size: 658 Bytes

Contents

#!/usr/bin/env ruby
#
# Measures the time it takes to encode messages of increasing size.

$LOAD_PATH.unshift(File.expand_path("../lib", File.dirname(__FILE__)))

require 'benchmark'
require 'avro_turf'

# Number of iterations per run.
N = 10_000

Benchmark.bm(15) do |x|
  sizes = [1, 10, 100, 1_000, 10_000]
  avro = AvroTurf.new(schemas_path: File.dirname(__FILE__))

  sizes.each do |size|
    data = {
      "name" => "John" * size,
      "address" => {
        "street" => "1st st." * size,
        "city" => "Citytown" * size
      }
    }

    x.report("size #{size}:") do
      N.times { avro.encode(data, schema_name: "person") }
    end
  end
end

Version data entries

37 entries across 37 versions & 2 rubygems

Version Path
avro_turf-0.11.0 perf/encoding_speed.rb
avro_turf-0.10.0 perf/encoding_speed.rb
avro_turf-0.9.0 perf/encoding_speed.rb
avro_turf-0.8.1 perf/encoding_speed.rb
avro_turf_enchanced-0.7.4 perf/encoding_speed.rb
avro_turf-0.8.0 perf/encoding_speed.rb
avro_turf_enchanced-0.7.3 perf/encoding_speed.rb
avro_turf-0.7.2 perf/encoding_speed.rb
avro_turf-0.7.1 perf/encoding_speed.rb
avro_turf-0.7.0 perf/encoding_speed.rb
avro_turf-0.6.2 perf/encoding_speed.rb
avro_turf-0.6.1 perf/encoding_speed.rb
avro_turf-0.6.0 perf/encoding_speed.rb
avro_turf-0.5.0 perf/encoding_speed.rb
avro_turf-0.4.1 perf/encoding_speed.rb
avro_turf-0.4.0 perf/encoding_speed.rb
avro_turf-0.3.0 perf/encoding_speed.rb