benchmarks/speed.rb in pastel-0.3.0 vs benchmarks/speed.rb in pastel-0.4.0
- old
+ new
@@ -4,13 +4,18 @@
pastel = Pastel.new
Benchmark.ips do |bench|
bench.config(time: 5, warmup: 2)
- bench.report('styles') do
- pastel.styles
+ bench.report('color decorate') do
+ pastel.decorate('string', :red, :on_green, :bold)
end
- bench.report('decorate') do
- pastel.decorate('string', :red, :on_green, :bold)
+ bench.report('dsl styling') do
+ pastel.red.on_green.bold('string')
end
+
+ bench.compare!
end
+
+# color decorate: 14K/s
+# dsl styling: 10K/s