-
Notifications
You must be signed in to change notification settings - Fork 0
CAT 004
unurgunite edited this page Jul 11, 2026
·
3 revisions
Severity:
warning• Confidence:high• Auto-fix: ❌
Array#include? in loop → Set — Using Array#includes? inside a loop is O(n) per check. Use a Set for O(1) lookups.
large_array.each do |x|
if other_array.includes?(x)
...
end
endTip
This rule can significantly improve performance in hot code paths.
Note
See bench results at bench/cat-004/