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_zip.yml
Nobuyoshi Nakada 54acb3dd52
Improved Enumerable::Lazy#zip
|                    |compare-ruby|built-ruby|
|:-------------------|-----------:|---------:|
|first_ary           |    290.514k|  296.331k|
|                    |           -|     1.02x|
|first_nonary        |    166.954k|  169.178k|
|                    |           -|     1.01x|
|first_noarg         |    299.547k|  305.358k|
|                    |           -|     1.02x|
|take3_ary           |    129.388k|  188.360k|
|                    |           -|     1.46x|
|take3_nonary        |     90.684k|  112.688k|
|                    |           -|     1.24x|
|take3_noarg         |    131.940k|  189.471k|
|                    |           -|     1.44x|
|chain-first_ary     |    195.913k|  286.194k|
|                    |           -|     1.46x|
|chain-first_nonary  |    127.483k|  168.716k|
|                    |           -|     1.32x|
|chain-first_noarg   |    201.252k|  298.562k|
|                    |           -|     1.48x|
|chain-take3_ary     |    101.189k|  183.188k|
|                    |           -|     1.81x|
|chain-take3_nonary  |     75.381k|  112.301k|
|                    |           -|     1.49x|
|chain-take3_noarg   |    101.483k|  192.148k|
|                    |           -|     1.89x|
|block               |    296.696k|  292.877k|
|                    |       1.01x|         -|
2020-07-23 16:57:26 +09:00

22 lines
618 B
YAML

prelude: |
a = (1..3).lazy
b = a.map {|x| x}
benchmark:
first_ary: a.zip(["a", "b", "c"]).first
first_nonary: a.zip("a".."c").first
first_noarg: a.zip.first
take3_ary: a.zip(["a", "b", "c"]).take(3).force
take3_nonary: a.zip("a".."c").take(3).force
take3_noarg: a.zip.take(3).force
chain-first_ary: b.zip(["a", "b", "c"]).first
chain-first_nonary: b.zip("a".."c").first
chain-first_noarg: b.zip.first
chain-take3_ary: b.zip(["a", "b", "c"]).take(3).force
chain-take3_nonary: b.zip("a".."c").take(3).force
chain-take3_noarg: b.zip.take(3).force
block: a.zip("a".."c") {|x, y| [x, y]}