blob: aa6e549e0c42241c7795ba368ee0b5540d2703df (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
prelude: |
h1, h10, h100, h1000 = [1, 10, 100, 1000].map do |n|
h = {kw: 1}
n.times{|i| h[i.to_s.to_sym] = i}
h
end
eh = {}
def kw(kw: nil, **kws) end
benchmark:
1: |
kw(**h1)
1_mutable: |
kw(**eh, **h1)
10: |
kw(**h10)
10_mutable: |
kw(**eh, **h10)
100: |
kw(**h100)
100_mutable: |
kw(**eh, **h100)
1000: |
kw(**h1000)
1000_mutable: |
kw(**eh, **h1000)
|