Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- prelude: |
- hash = {a: 1}
- arr = [hash]
- arr2 = [1]
- class Object
- def a(x) end
- if ENV['R2']
- ruby2_keywords def foo(*args) bar(*args) end
- else
- def foo(*args, **kw) bar(*args, **kw) end
- end
- def bar(*args) end
- end
- if ENV['R2']
- b = proc do
- 300.times{a(*arr)}
- foo(*arr)
- end
- else
- b = proc do
- 300.times{a(*arr)}
- foo(*arr, **{})
- end
- end
- c = proc do
- 300.times{a(*arr)}
- foo(*arr2)
- end
- benchmark:
- worst_case: "a(*arr)"
- one_per_3hundred_hash: "b.call"
- one_per_3hundred_nonhash: "c.call"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement