Patch #29305

Use Hash#each_key instead of Hash#keys.each

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

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

0%

Category:Performance
Target version:4.0.0

Description

Hash#each_key is faster than Hash#keys.each because it does not allocate a new array when iterating keys. See https://github.com/JuanitoFatas/fast-ruby#hasheach_key-instead-of-hashkeyseach-code for details.

replace-each-with-each_key.diff Magnifier (2.68 KB) Go MAEDA, 2018-07-31 23:53

Associated revisions

Revision 17458
Added by Go MAEDA 3 months ago

Replace Hash#keys.each with faster Hash#each_key (#29305).

Patch by Go MAEDA.

History

#1 Updated by Go MAEDA 3 months ago

  • Target version set to 4.1.0

#2 Updated by Go MAEDA 3 months ago

  • Status changed from New to Closed
  • Target version changed from 4.1.0 to 4.0.0

Committed.

#3 Updated by Go MAEDA about 1 month ago

  • Assignee set to Go MAEDA

Also available in: Atom PDF