fastruby / fastruby/fast-ruby

Method call in a block could compare to `&:method_name` too

未關閉
#201 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
Suggestion
主要語言
Ruby
星號
5.7k
分支
371
PR 合併指標
30 天內沒有已合併 PR

描述

This test https://github.com/fastruby/fast-ruby/blob/master/code/general/block-apply-method.rb is comparing:

```rb
def fast
[1, 2, 3].map { |n| do_something(n) }
end

def slow
[1, 2, 3].map(&method(:do_something))
end
```

We could have one more test:

```
def other
[1, 2, 3].map(&:do_something)
end
```

Also, I think the names `fast` and `slow` shouldn't be used for the methods, the names should describe what the method does, not which one is faster?

貢獻指南

開啟貢獻指南

研究方向

從 code/general/block-apply-method.rb 開始,檢查其中現有比較的結構。加入 &:do_something 情況,並將 fast 和 slow 重新命名為描述其行為的名稱。當檔案包含具有描述性方法名稱的全部三種可比較形式,且其現有 benchmark 或 test 仍能執行時,即表示完成。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
ruby
領域
performance
Issue 類型
功能
難度
2/5
預估耗時
1-3 小時
活躍度
停滯
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。