in reply to Re: Re: Slow at sorting?
in thread Slow at sorting?
pack("n N n", $1, $2, $3).$4
thereby we would sort CD# > 9 correctly, decrease the memory footprint and allow for the fast intrinsic ASCIIbetical sort.
Perhaps even to the point where fast hash lookups can be used.
It's a pity the data is in practice unavailable
Here's what I would like to time ...
. . my (%sort_hash); my $offset = 0; while (<IN>) { if( m/^CD(\d+)\\(\d+)\.pdf\((\d+)\)\s-\s\[(.+?)\]/ ) { $sort_hash{pack("n N n", $1, $2, $3).$4} = $offset; } $offset = tell(IN); } foreach my $k (sort keys %sort_hash) { seek IN, $sort_hash{$k}, 0; print OUT scalar(<IN>); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Slow at sorting?
by petral (Curate) on Nov 22, 2001 at 03:56 UTC | |
by guha (Priest) on Nov 22, 2001 at 04:08 UTC |