Skip to content

Files

Latest commit

 

History

History
21 lines (13 loc) · 399 Bytes

Performance-SortReverse.md

File metadata and controls

21 lines (13 loc) · 399 Bytes

Pattern: Missing use of sort.reverse

Issue: -

Description

Identifies places where sort { |a, b| b <⇒ a } can be replaced by a faster sort.reverse.

Examples

# bad
array.sort { |a, b| b <=> a }

# good
array.sort.reverse

Further Reading