Skip to content

Commit

Permalink
add benchmark rake task
Browse files Browse the repository at this point in the history
  • Loading branch information
psimk committed Mar 27, 2024
1 parent d6d0928 commit dcc120c
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tasks/benchmark.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# frozen_string_literal: true

require 'benchmark'
require 'prometheus/client'

task :increment do
n = 1_000_000
counter = Prometheus::Client::Counter.new(:counter, 'Benchmark counter')

Benchmark.bm do |x|
x.report { n.times { counter.increment; } }
x.report { n.times { counter.increment({}, 1, '', ''); } }
end
end

0 comments on commit dcc120c

Please sign in to comment.