rails/rails — pull request #17174 by effektz (2014-10-04 05:24:25+00:00)
Title: Don't mutate options param

This proposal comes from discussion in #17152 - Here `options[:type]` is no longer being deleted from `options`, and hash assignment changed to remove merge. Here's why:

Benchmark:
```
n = 10_000_000
Benchmark.bm do |x|
x.report do
n.times do
merged_options = options.merge(:root => key, :skip_instruct => true)
end
end
x.report do
n.times do
merged_options = options
merged_options[:root] = key
merged_options[:skip_instruct] = true
end
end
end
```

Results:
```
user system total real
17.240000 0.000000 17.240000 ( 16.897622)
1.670000 0.000000 1.670000 ( 1.676303)

user system total real
16.830000 0.000000 16.830000 ( 16.875042)
1.710000 0.000000 1.710000 ( 1.718011)

user system total real
17.180000 0.000000 17.180000 ( 17.253324)
1.690000 0.000000 1.690000 ( 1.693748)

user system total real
17.170000 0.000000 17.170000 ( 17.246582)
1.650000 0.000000 1.650000 ( 1.653273)

user system total real
18.160000 0.000000 18.160000 ( 18.250755)
1.670000 0.000000 1.670000 ( 1.676023)
```

If either this PR or #17152 is accepted, the other can be closed.