Sha256: 7334a6bdda04959efcb0066df34f79917af2c14eb900611f3220c72426d90ad8

Contents?: true

Size: 404 Bytes

Versions: 4

Compression:

Stored size: 404 Bytes

Contents

require 'benchmark'
require_relative '../lib/restpack_serializer'

class SimpleSerializer
  include RestPack::Serializer
  attributes :id, :title
end

iterations = 180_000 #180_000 ~> 1 second
Benchmark.bm(22) do |bm|
  bm.report('simple serializer') do

    model = {
      id: 123,
      title: 'This is the title'
    }

    iterations.times do
      SimpleSerializer.as_json(model)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
restpack_serializer-0.6.3 performance/perf.rb
restpack_serializer-0.6.2 performance/perf.rb
restpack_serializer-0.6.1 performance/perf.rb
restpack_serializer-0.5.10 performance/perf.rb