in reply to Re^3: In-place sort with order assignment
in thread In-place sort with order assignment
On your computer?
No!
#! perl -slw use strict; our $N //= 10e6; my %hash; my $val = 'AAAAA'; undef $hash{ $val++ } for 1 .. $N; my $start = time; open SORT, '| sort > sorted' or die $!; print SORT $_ while $_ = each %hash; close SORT; undef %hash; open IN, '<', 'sorted' or die $!; chomp(), $hash{ $_ } = $. while <IN>; close IN; my $elapsed = time - $start; printf "Took %.6f seconds for $N items (%.5f per second)\n", $elapsed, $elapsed / $N; __END__ C:\test>junk41 -N=10e6 Took 225.000000 seconds for 10e6 items (0.00002 per second)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: In-place sort with order assignment
by rowdog (Curate) on Sep 20, 2010 at 22:37 UTC | |
by BrowserUk (Patriarch) on Sep 21, 2010 at 00:15 UTC |