Sha256: f89a01fc0f7625c1449687060b571cfac396608bf1e76938292583f0542a4a26

Contents?: true

Size: 561 Bytes

Versions: 4

Compression:

Stored size: 561 Bytes

Contents

$:.unshift(File.dirname(__FILE__) + '/../lib')

require 'erlectricity'
require 'benchmark'

data = [:ok, [:foo, :bar, [99, "bottles", "of", "beer", 3.14], [true, false]]]
bert = Erlectricity::Encoder.encode(data)

p bert

Benchmark.bm do|b|
  b.report("Decoder") do
    100_000.times { Erl::Decoder.decode(bert) }
  end
end

#               user        system     total    real
# C Decoder      0.400000   0.000000   0.400000 (  0.425373)
# Ruby Decoder  30.250000   0.220000  30.470000 ( 32.140890)
#
# C decoder is 75.56x faster than Ruby decoder on this data

Version data entries

4 entries across 4 versions & 3 rubygems

Version Path
mojombo-erlectricity-1.0.2 benchmarks/bench.rb
erlectricity-funbox-1.1.2 benchmarks/bench.rb
erlectricity-1.1.1 benchmarks/bench.rb
erlectricity-1.1.0 benchmarks/bench.rb