1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/benchmark/enum_lazy_flat_map.yml

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

17 lines
566 B
YAML
Raw Normal View History

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