Sha256: fa40e6b083456c17a87b44b4112184af4c927a42d68f35ae0b93e953f0a2c569

Contents?: true

Size: 869 Bytes

Versions: 15

Compression:

Stored size: 869 Bytes

Contents

# encoding: ascii-8bit

require_relative '../spec_helper'
require_relative '../helpers/fake_blockchain'
require 'benchmark'

[
 [:sequel, :postgres]
].compact.each do |options|

  next  unless storage = setup_db(*options)

  describe "#{storage.backend_name} block storage" do

    before do
      @store = storage
      @store.reset
      @store.log.level = :error
      @fake_chain = FakeBlockchain.new 10
    end

    it "block storage" do
      blocks = (0..10).to_a.map{|i|  @fake_chain.block(i) }

      bm = Benchmark.measure do
        bm = Benchmark.bm do |b|
          blocks.each.with_index do |blk,i|
            b.report("storing fake block ##{i}") do
              depth, chain = @store.new_block blk
              chain.should == 0
            end
          end
        end
      end
      puts '-'*80
      puts "TOTAL #{bm.format}"
    end


  end
end

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
bitcoin-ruby-0.0.18 spec/bitcoin/performance/storage_spec.rb
bitcoin-ruby-0.0.17 spec/bitcoin/performance/storage_spec.rb
bitcoin-ruby-0.0.16 spec/bitcoin/performance/storage_spec.rb
bitcoin-ruby-0.0.15 spec/bitcoin/performance/storage_spec.rb
monacoin-ruby-0.1.3 spec/bitcoin/performance/storage_spec.rb
monacoin-ruby-0.1.2 spec/bitcoin/performance/storage_spec.rb
bitcoin-ruby-0.0.14 spec/bitcoin/performance/storage_spec.rb
bitcoin-ruby-0.0.13 spec/bitcoin/performance/storage_spec.rb
bitcoin-ruby-0.0.12 spec/bitcoin/performance/storage_spec.rb
bitcoin-ruby-0.0.11 spec/bitcoin/performance/storage_spec.rb
bitcoin-ruby-0.0.10 spec/bitcoin/performance/storage_spec.rb
bitcoin-ruby-0.0.9 spec/bitcoin/performance/storage_spec.rb
bitcoin-ruby-0.0.8 spec/bitcoin/performance/storage_spec.rb
bitcoin-ruby-0.0.7 spec/bitcoin/performance/storage_spec.rb
bitcoin-ruby-0.0.6 spec/bitcoin/performance/storage_spec.rb