On Thu, Jun 17, 1999 at 01:11:25AM +0000, Richard K. Moore wrote: > > 6/16/99, Ronald J Kimball wrote: > >If you want to sort the entire file by line, you have to read the entire > >file into memory. You can then use a Schwartzian Transform to efficiently > >sort the lines: > > > Dear Ron and list, > > I'm curious as to why people haven't been advising the use of a hash (or > two). Alan's application seems to be one with only a small amount of data. > Is the Schwartzian Transform incredibly faster as a solution for large > amounts of data? > I'm not sure what you mean by "the use of a hash". How would a hash be involved in sorting an array? Yes, Schwartzian Transform is a big win for larger data sets. The idea is that the comparison function is called many many times, so it do as little work as possible. By doing all the munging before the sort and creating a list of anonymous arrays, all the comparison function has to do is a couple of dereferences and array indexes. For smaller data sets, where the comparison function is not called as many times, the Schwartzian Transform is not as big a win. Ronald ===== Want to unsubscribe from this list? ===== Send mail with body "unsubscribe" to macperl-request@macperl.org