Sha256: e57d4c643d187b6007f826b93534ebfde01d3eb664eb13ed25eede66fbae22aa

Contents?: true

Size: 528 Bytes

Versions: 5

Compression:

Stored size: 528 Bytes

Contents

require 'pastel'
require 'benchmark/ips'

pastel = Pastel.new

Benchmark.ips do |bench|
  bench.config(time: 5, warmup: 2)

  bench.report('regular nesting') do
    pastel.red.on_green('Unicorns' +
      pastel.green.on_red('will ', 'dominate' + pastel.yellow('the world!')))
  end

  bench.report('block nesting') do
    pastel.red.on_green('Unicorns') do
      green.on_red('will ', 'dominate') do
        yellow('the world!')
      end
    end
  end

  bench.compare!
end

# regular nesting: 2800/s
# block nesting:   2600/s

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
pastel-0.5.3 benchmarks/nesting_speed.rb
pastel-0.5.2 benchmarks/nesting_speed.rb
pastel-0.5.1 benchmarks/nesting_speed.rb
pastel-0.5.0 benchmarks/nesting_speed.rb
pastel-0.4.0 benchmarks/nesting_speed.rb