1 A Fresh Look at Efficient Perl Sorting
3 Uri Guttman, John Porter, and Larry Rosler
7 Sorting is one of the primary needs of programming, because most
8 programs produce reports of sorted data. Efficient sorting therefore
9 receives a great deal of attention in the Perl documentation, FAQ,
10 FMTYEWTK, books, and newsgroups. In this paper, we review and compare
11 several methods for Perl sorting: external ('system'),
12 repeatedly-computed-keys ('naive'), cached-keys ('Orcish Maneuver'), and
13 mapped-keys ('Schwartz Transform'). We then present a little-known
14 approach ('single-string key-and-value'), which relies for efficiency on
15 the default sort algorithm. This method typically provides much better
16 performance than the other approaches, and is easy to implement directly