SHARE
TWEET

Untitled

a guest Oct 23rd, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. require 'benchmark'
  2. class Object
  3. def foo(*args, **kw) bar(*args, **kw) end
  4. ruby2_keywords def baz(*args) bar(*args) end
  5. def bar(*args) args end
  6. end
  7. h = {a: 1}
  8. puts(Benchmark.measure do
  9.   100000.times do
  10.   foo()
  11.   foo(**h)
  12.   foo(1)
  13.   foo(1, **h)
  14. end
  15. end)
  16.  
  17. puts(Benchmark.measure do
  18.   100000.times do
  19.   baz()
  20.   baz(**h)
  21.   baz(1)
  22.   baz(1, **h)
  23. end
  24. end)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top