Sha256: 697d25fe30821be536aedf3eda2a955e6c7deae7549bf1aba7519072f91e3d84

Contents?: true

Size: 1.22 KB

Versions: 5

Compression:

Stored size: 1.22 KB

Contents

require 'pastel'
require 'benchmark/ips'

pastel = Pastel.new

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

  bench.report('color decorate') do
    pastel.decorate('string', :red, :on_green, :bold)
  end

  bench.report('dsl styling') do
    pastel.red.on_green.bold('string')
  end

  bench.compare!
end

# version 0.6.0

# Calculating -------------------------------------
#       color decorate      7346 i/100ms
#          dsl styling      3436 i/100ms
# -------------------------------------------------
#       color decorate    96062.1 (±7.9%) i/s -     484836 in   5.081126s
#          dsl styling    38761.1 (±13.9%) i/s -     192416 in   5.065053s
#
# Comparison:
#       color decorate:    96062.1 i/s
#          dsl styling:    38761.1 i/s - 2.48x slower

# version 0.5.3

# Calculating -------------------------------------
#       color decorate      1428 i/100ms
#          dsl styling      1174 i/100ms
# -------------------------------------------------
#       color decorate    16113.1 (±21.5%) i/s -      77112 in   5.054487s
#          dsl styling    12622.9 (±20.8%) i/s -      61048 in   5.076738s
#
# Comparison:
#       color decorate:    16113.1 i/s
#          dsl styling:    12622.9 i/s - 1.28x slower
#

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
pastel-0.7.2 benchmarks/speed.rb
pastel-0.7.1 benchmarks/speed.rb
pastel-0.7.0 benchmarks/speed.rb
pastel-0.6.1 benchmarks/speed.rb
pastel-0.6.0 benchmarks/speed.rb