Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False positive for select_first_vs_detect when first is first(N) #99

Closed
owst opened this issue Mar 10, 2023 · 1 comment
Closed

False positive for select_first_vs_detect when first is first(N) #99

owst opened this issue Mar 10, 2023 · 1 comment

Comments

@owst
Copy link

owst commented Mar 10, 2023

With this example code:

(1..100).select { |i| i >= 50 }.first(5)

fasterer 0.10.0 reports Array#select.first is slower than Array#detect..

However, this is only true when Enumerable#first takes no argument; here we want the first 5 matching elements and detect does not support that functionality.

I suggest that this detector only fires when first is passed no argument

@DamirSvrtan
Copy link
Owner

hey @owst, thanks for reporting, I've released fasterer 0.10.1 with this bugfix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants