Skip to content

Commit 3ada125

Browse files
committed
Fash method comes first for better reading.
1 parent d960cf0 commit 3ada125

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

code/hash/bracket-vs-dup.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
HASH = Hash[*('a'..'z').to_a]
44

5-
def slow
6-
HASH.dup
7-
end
8-
95
def fast
106
Hash[HASH]
117
end
128

9+
def slow
10+
HASH.dup
11+
end
12+
1313
Benchmark.ips do |x|
1414
x.report("Hash[]") { fast }
1515
x.report("Hash#dup") { slow }

0 commit comments

Comments
 (0)