Sha256: db05c00463d4131e42a3213a8cbc1d0f933b591eb4c01932c895bccb6153d958

Contents?: true

Size: 986 Bytes

Versions: 5

Compression:

Stored size: 986 Bytes

Contents

require 'rubygems'
require 'bundler/setup'
require 'benchmark'
require 'rspec/expectations'
include RSpec::Matchers

n = 100_000

Benchmark.bm(25) do |bm|
  bm.report("to_stdout with StringIO") do
    n.times { expect {}.not_to output('foo').to_stdout }
  end

  bm.report("to_stdout with Tempfile") do
    n.times { expect {}.not_to output('foo').to_stdout_from_any_process }
  end

  bm.report("to_stderr with StringIO") do
    n.times { expect {}.not_to output('foo').to_stderr }
  end

  bm.report("to_stderr with Tempfile") do
    n.times { expect {}.not_to output('foo').to_stderr_from_any_process }
  end
end

#                                 user     system      total        real
# to_stdout with StringIO     0.470000   0.010000   0.480000 (  0.467317)
# to_stdout with Tempfile     8.920000   7.420000  16.340000 ( 16.355174)
# to_stderr with StringIO     0.460000   0.000000   0.460000 (  0.454059)
# to_stderr with Tempfile     8.930000   7.560000  16.490000 ( 16.494696)

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
opal-rspec-1.1.0.alpha3 rspec-expectations/upstream/benchmarks/output_stringio_vs_tempfile.rb
opal-rspec-1.1.0.alpha2 rspec-expectations/upstream/benchmarks/output_stringio_vs_tempfile.rb
opal-rspec-1.1.0.alpha1 rspec-expectations/upstream/benchmarks/output_stringio_vs_tempfile.rb
opal-rspec-1.0.0 rspec-expectations/upstream/benchmarks/output_stringio_vs_tempfile.rb
opal-rspec-1.0.0.alpha1 rspec-expectations/upstream/benchmarks/output_stringio_vs_tempfile.rb