1.7: Sort Styles
Prev
Next
Index
Sort::Maker
Page 7/12
Four different sorting styles to choose from
Plain
Orcish Manouvre
Schwartian Transform (ST)
Guttman-Rosler Transform (GRT)
Each has its uses and advantages
Styles are really different ways to cache extracted keys
Caching keys moves key extraction from O( N log N ) to O( N )
In larger sizes of sort sets, caching keys is a very big win
This is a classic sort of arrays of numbers
Compare this code to the generated code for the different sort styles
sort { $a->[0] cmp $b->[0] || $a->[1] cmp $b->[1] }
Prev
Next
Index
YAPC::NA 2004, Buffalo, NY
Page 7/12
© 2004 Uri Guttman