mirror of
https://github.com/lloeki/ruby-benchmarks.git
synced 2025-12-06 00:44:39 +01:00
16 lines
249 B
Ruby
Executable file
16 lines
249 B
Ruby
Executable file
#!/usr/bin/env ruby
|
|
# frozen_string_literal: true
|
|
|
|
require 'benchmark/ips'
|
|
|
|
value = 'value'
|
|
|
|
Benchmark.ips do |x|
|
|
x.time = 5
|
|
x.warmup = 0.5
|
|
|
|
x.report('format') { format('key:%s', value) }
|
|
x.report('#{}') { "key:#{value}" }
|
|
|
|
x.compare!
|
|
end
|