Patch #34160

Replace Hash#merge! with Hash#[]=

Added by Go MAEDA about 1 month ago. Updated about 1 month ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Go MAEDA% Done:

0%

Category:Performance
Target version:4.2.0

Description

Hash#[]= is faster than Hash#merge!.

https://docs.rubocop.org/rubocop-performance/cops_performance.html#performanceredundantmerge
https://github.com/JuanitoFatas/fast-ruby#hashmerge-vs-hash-code

Replacement can be done with RuboCop:

bundle exec rubocop --only Performance/RedundantMerge -a

Associated revisions

Revision 20175
Added by Go MAEDA about 1 month ago

Replace Hash#merge! with Hash#[]= (#34160).

History

#1 Updated by Go MAEDA about 1 month ago

  • Status changed from New to Closed

Done.

#2 Updated by Go MAEDA about 1 month ago

  • Assignee set to Go MAEDA

Also available in: Atom PDF