Sha256: 875f4f9466a14153401d7228a39000bba3075300e7cd96f295a3bb8bbd02733d

Contents?: true

Size: 895 Bytes

Versions: 12

Compression:

Stored size: 895 Bytes

Contents

#!/usr/bin/env ruby

require "bundler/setup"

require "active_remote"
require "benchmark/ips"

class Author < ::ActiveRemote::Base
  attribute :guid, :string
  attribute :name, :string
  attribute :age, :integer
  attribute :birthday, :datetime
  attribute :writes_fiction, :boolean
  attribute :net_sales, :float
end

ATTRIBUTES = {
  :guid => "0c030733-3b78-4587-b94b-5e0cf26497c5",
  :name => "Charles Dickens",
  :age => 68,
  :birthday => "1812-02-07 00:00:00",
  :writes_fiction => true,
  :net_sales => 1_000_000.0
}

::Benchmark.ips do |x|
  x.config(:time => 20, :warmup => 10)
  x.report("initialize") do
    ::Author.new(ATTRIBUTES)
  end

  x.report("instantiate") do
    ::Author.instantiate(ATTRIBUTES)
  end

  x.report("init attributes") do
    ::Author.new(ATTRIBUTES).attributes
  end

  x.report("inst attributes") do
    ::Author.instantiate(ATTRIBUTES).attributes
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
active_remote-7.1.0 bin/benchmark
active_remote-6.0.3 bin/benchmark
active_remote-6.1.2 bin/benchmark
active_remote-7.0.0 bin/benchmark
active_remote-6.1.1 bin/benchmark
active_remote-6.1.0 bin/benchmark
active_remote-6.0.2 bin/benchmark
active_remote-6.0.1 bin/benchmark
active_remote-6.0.0.beta bin/benchmark
active_remote-5.2.0 bin/benchmark
active_remote-5.2.0.beta bin/benchmark
active_remote-5.2.0.alpha bin/benchmark