1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/tools
schneems e1a7260640 Use block variable instead of global
```ruby
require 'benchmark/ips'

Benchmark.ips do |x|
  x.report("$&") {
    "foo".sub(/f/) { $&.upcase }
  }
  x.report("block var") {
    "foo".sub(/f/) {|match| match.upcase }
  }
end

```

```
Calculating -------------------------------------
                  $&    48.658k i/100ms
           block var    49.666k i/100ms
-------------------------------------------------
                  $&    873.156k (± 9.3%) i/s -      4.331M
           block var    969.744k (± 9.2%) i/s -      4.818M
```

It's faster, and gets rid of a few "magic" global variables
2015-06-01 19:44:40 -05:00
..
console ./tools/console to drop into irb with rails loaded 2010-03-28 18:18:25 -07:00
line_statistics Doc fix [ci skip] 2015-03-06 23:37:54 +05:30
profile Use block variable instead of global 2015-06-01 19:44:40 -05:00
README.md minor docs change [ci skip] 2014-11-03 12:37:39 +05:30

Rails dev tools

This is a collection of utilities used for Rails internal development. They aren't used by Rails apps directly.

  • console drops you in irb and loads local Rails repos
  • profile profiles Kernel#require to help reduce startup time