Redis #keys method shouldn't trigger Hash#each_key recommendation
tbehling opened this issue · 1 comments
tbehling commented
Hi! First, thanks so much for fasterer
-- it's super helpful!
I wanted to report a false-positive finding that I noticed. When using a Redis client, I'm using its keys
method, which lists the names of the Redis server's keys. At least in this case, Fasterer makes a recommendation based on an incorrect presumption that the receiver is a Hash
, not a Redis connection handle.
$ cat > foo.rb
@redis.keys('queue:*').each do |queue_name|
puts queue_name
end
^D
$ bundle exec fasterer foo.rb
foo.rb:1 Hash#keys.each is slower than Hash#each_key. N.B. Hash#each_key cannot be used if the hash is modified during the each block.
1 file inspected, 1 offense detected
DamirSvrtan commented
Hi! Thanks for reporting this, I have implemented a small change that is released in 0.11.0, can you verify that it's not reporting it anymore?
Thanks in advance!