File: caller_vs_caller_locations.rb

package info (click to toggle)
ruby-rspec 3.13.0c0e0m0s1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 6,856 kB
  • sloc: ruby: 70,868; sh: 1,423; makefile: 99
file content (19 lines) | stat: -rw-r--r-- 592 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
require 'benchmark/ips'

Benchmark.ips do |x|
  x.report("caller()              ") { caller }
  x.report("caller_locations()    ") { caller_locations }
  x.report("caller(1, 2)          ") { caller(1, 2) }
  x.report("caller_locations(1, 2)") { caller_locations(1, 2) }
end

__END__

caller()
                        118.586k (±17.7%) i/s -    573.893k
caller_locations()
                        355.988k (±17.8%) i/s -      1.709M
caller(1, 2)
                        336.841k (±18.6%) i/s -      1.615M
caller_locations(1, 2)
                        781.330k (±23.5%) i/s -      3.665M