summaryrefslogtreecommitdiff
path: root/benchmark/enum_lazy_flat_map.yml
blob: 0ee390a4411270d1c33c8efc7405429e583b111b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
prelude: |
  num = (1..).lazy.take(100)
  ary2 = [[1,2]].cycle.lazy.take(10)
  ary10 = [[*1..10]].cycle.lazy.take(10)
  ary20 = [[*1..20]].cycle.lazy.take(10)
  ary50 = [[*1..50]].cycle.lazy.take(10)
  ary100 = [[*1..100]].cycle.lazy.take(10)

benchmark:
  num3: num.flat_map {|x| x}.take(3).to_a
  num10: num.flat_map {|x| x}.take(3).to_a
  ary2:  ary2.flat_map {|x| x}.take(3).to_a
  ary10: ary10.flat_map {|x| x}.take(3).to_a
  ary20: ary20.flat_map {|x| x}.take(3).to_a
  ary50: ary50.flat_map {|x| x}.take(3).to_a
  ary100: ary100.flat_map {|x| x}.take(3).to_a