Permalink
Browse files

remove_duplicates.pl: use less memory

  • Loading branch information...
zenogantner committed Mar 30, 2012
1 parent ca6410f commit d37b06aba8b450d6c2e108cd249a835f04368b0d
Showing with 3 additions and 2 deletions.
  1. +3 −2 scripts/kddcup2012/remove_duplicates.pl
@@ -16,6 +16,7 @@
'write-timestamps' => \(my $write_timestamps = 0),
) or die "Did not understand command line parameters.\n";
+my $remember_timestamps = $sorted_output || $write_timestamps;
my $separator_regex = qr{\t};
@@ -35,12 +36,12 @@
my $key = "$user\t$item";
if (exists $result{$key} && $result != 1) {
if ($result{$key} == $result) {
- $timestamp{$key} = $timestamp;
+ $timestamp{$key} = $timestamp if $remember_timestamps;
}
}
else {
$result{$key} = $result;
- $timestamp{$key} = $timestamp;
+ $timestamp{$key} = $timestamp if $remember_timestamps;
}
}

0 comments on commit d37b06a

Please sign in to comment.