Method call in a block could compare to `&:method_name` too
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 45/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- ruby
- Domain
- performance
Research direction
Start with code/general/block-apply-method.rb and inspect how its existing comparisons are structured. Add the &:do_something case and rename fast and slow to names describing their behavior. Done means the file contains all three comparable forms with descriptive method names and its existing benchmark or test still runs.
Written by the indexing model from the issue text.
Description
This test https://github.com/fastruby/fast-ruby/blob/master/code/general/block-apply-method.rb is comparing:
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?
- Dominant language
- Ruby
- Stars
- 5.7k
- Forks
- 370
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from fastruby/fast-ruby
-
Difficulty 2/5 1-3 hours Newbie friendliness 52/100
-
Difficulty 4/5 3-5 days Newbie friendliness 32/100
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
-
Difficulty 4/5 3-5 days Newbie friendliness 42/100
All issues in fastruby/fast-ruby
Similar issues
-
user-reported
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Kong/developer.konghq.com#7316 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
TheOdinProject/curriculum#31408 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
bensheldon/good_job#1816 · 5 comments ·