SHARE
TWEET

Untitled

a guest Oct 23rd, 2019 111 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. prelude: |
  2.   hash = {a: 1}
  3.   arr = [hash]
  4.   arr2 = [1]
  5.   class Object
  6.     def a(x) end
  7.     if ENV['R2']
  8.       ruby2_keywords def foo(*args) bar(*args) end
  9.     else
  10.       def foo(*args, **kw) bar(*args, **kw) end
  11.     end
  12.     def bar(*args) end
  13.   end
  14.  
  15.   if ENV['R2']
  16.     b = proc do
  17.       300.times{a(*arr)}
  18.       foo(*arr)
  19.     end
  20.   else
  21.     b = proc do
  22.       300.times{a(*arr)}
  23.       foo(*arr, **{})
  24.     end
  25.   end
  26.   c = proc do
  27.     300.times{a(*arr)}
  28.     foo(*arr2)
  29.   end
  30. benchmark:
  31.   worst_case: "a(*arr)"
  32.   one_per_3hundred_hash: "b.call"
  33.   one_per_3hundred_nonhash: "c.call"
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
 
Top