Remove unnecessary Hash#to_a call

Inspired by 931ee4186b

```ruby

def stat(num)
  start = GC.stat(:total_allocated_object)
  num.times { yield }
  total_obj_count = GC.stat(:total_allocated_object) - start
  puts "#{total_obj_count / num} allocations per call"
end

h = { 'x' => 'y' }

stat(100) { h.     each { |pair| pair } }
stat(100) { h.to_a.each { |pair| pair } }

__END__
1 allocations per call
2 allocations per call
```
This commit is contained in:
Viktar Basharymau 2014-05-22 21:16:56 +03:00
parent 66dd216705
commit ee92c61689

@ -80,7 +80,7 @@ def match_route(name, options)
if named_routes.key?(name)
yield named_routes[name]
else
routes = non_recursive(cache, options.to_a)
routes = non_recursive(cache, options)
hash = routes.group_by { |_, r| r.score(options) }