diff options
author | Roque Pinel <repinel@gmail.com> | 2015-06-08 21:14:33 -0400 |
---|---|---|
committer | Roque Pinel <repinel@gmail.com> | 2015-06-08 21:27:01 -0400 |
commit | b28b192af194ca63fad6e3cde3b56b78f9132cac (patch) | |
tree | 87d6a1f1075caeeb0e31b99be97cc97495da5a68 /actionview/lib/action_view/helpers/cache_helper.rb | |
parent | bbbe1a58e60da079d5d353777561d1c998549571 (diff) | |
download | rails-b28b192af194ca63fad6e3cde3b56b78f9132cac.tar.gz rails-b28b192af194ca63fad6e3cde3b56b78f9132cac.tar.bz2 rails-b28b192af194ca63fad6e3cde3b56b78f9132cac.zip |
Use block variable instead of global
```ruby
Benchmark.ips do |x|
x.report("$&") {
"foo".gsub(/f/) { $&.hex }
}
x.report("block var") {
"foo".gsub(/f/) { |match| match.hex }
}
end
```
```
Calculating -------------------------------------
$& 23.271k i/100ms
block var 24.804k i/100ms
-------------------------------------------------
$& 321.981k (± 7.4%) i/s - 1.606M
block var 324.949k (± 9.2%) i/s - 1.612M
```
Diffstat (limited to 'actionview/lib/action_view/helpers/cache_helper.rb')
0 files changed, 0 insertions, 0 deletions