Skip to content

Upgrade benchmark-ips to 2.11.0

Peter Leitzen requested to merge pl-benchmark-ips-dep into master

What does this MR do and why?

Now hold! and save! can be used to compare independent invocations.

Example

require "benchmark/ips"

p n_('day', 'days', 0)
p n_('day', 'days', 1)
p n_('day', 'days', 2)

Benchmark.ips do |x|
  FastGettext::MoFile.prepend(MoFilePatchFast) if ENV['FAST']

  x.report "plural #{ENV['FAST'] ? 'fast' : 'slow'}" do
    n_('day', 'days', 1)
  end

  x.save! 'fast_gettext' # <--- NEW 
  x.compare!
end
Output
$ bin/rails runner foo.rb
WARNING: This version of GitLab depends on gitlab-shell 14.17.0, but you're running 14.15.0. Please update gitlab-shell.
"Tage"
"Tag"
"Tage"
Warming up --------------------------------------
         plural slow     8.325k i/100ms
Calculating -------------------------------------
         plural slow     85.413k (±19.9%) i/s -    416.250k in   5.052804s
peter@happy ~/devel/gitlab/gdk/gitlab on (master ?M)
$ FAST=1 bin/rails runner foo.rb
WARNING: This version of GitLab depends on gitlab-shell 14.17.0, but you're running 14.15.0. Please update gitlab-shell.
"Tage"
"Tag"
"Tage"
Warming up --------------------------------------
         plural fast    57.194k i/100ms
Calculating -------------------------------------
         plural fast    639.580k (±12.6%) i/s -      3.203M in   5.087519s

Comparison:
         plural fast:   639579.9 i/s
         plural slow:    85412.9 i/s - 7.49x  slower

Diff

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Peter Leitzen

Merge request reports