thoughtbot/factory_girl — pull request #722 by umerkulovb (2014-11-14 03:12:37+00:00)
Title: Replace map.flatten with flat_map

As Erik Michaels-Ober recently noted, `flat_map` is significant faster than `map.flatten`

```ruby
require 'benchmark/ips'

ARRAY = 100.times.map { (0..100).to_a }

def slow
ARRAY.map { |x| x }.flatten(1)
end

def fast
ARRAY.flat_map { |x| x }
end

Benchmark.ips do |x|
x.report('slow') { slow }
x.report('fast') { fast }
end
```

```
Calculating -------------------------------------
slow 199.000 i/100ms
fast 2.626k i/100ms
-------------------------------------------------
slow 2.053k (± 5.9%) i/s - 10.348k
fast 24.377k (±12.7%) i/s - 120.796k
```