fasterer icon indicating copy to clipboard operation
fasterer copied to clipboard

Fasterer speedup for hash_update_vs_hash_brackets

Open manjunath724 opened this issue 4 years ago • 1 comments

Hash.update is an alias for Hash.merge!

Currently we have hash_merge_bang_vs_hash_brackets which suggests us to replace Hash#merge!() with Hash#[] but it doesn't suggest for Hash#update().

Example

  • hash.merge!({"key" => "value"}) -> offensive
  • hash.update({"key" => value}) -> not offensive

Can we extend this to Hash.update()?

manjunath724 avatar Jun 03 '20 09:06 manjunath724

Sounds good to me - would you be willing to document this speed up first in the https://github.com/JuanitoFatas/fast-ruby repository and then submit a PR to fasterer?

Thanks!

DamirSvrtan avatar Jan 14 '21 04:01 DamirSvrtan