Re: enhancement to mhfinddup

[email protected]
Newsgroups gmane.mail.nmh.devel,gmane.mail.exmh.user
Message-ID <[email protected]>
On Tue, 09 Sep 2008 11:41:43 EDT, [email protected] said:

> Below you can find the diff (suitable for feeding to patch(1)) against 
> mhfinddup 1.2.

Possible enhancement for 1.3 - I'd code and test but am swimming in other work
today...

>                 $msgs{$msgid} =~ m|^\+(.*)/(\d+)$|;
>                 my($f, $m) = ($1, $2);
>                 if ($folder eq $f || $no_same_folder) {
...
> !                       my $sum1=md5_hex(@msgbody);

At this point, you could consider doing something like:

my %cached;

		if (exists $cached{"$folderpath/$m"}) {
			$sum1=$cached{$msgid};
		} else {
			$sum1=md5_hex(@msgbody);
			$cached{"$folderpath/$m"}=$sum1;
		}

and similarly for $sum2. Probably should move all the open/read/close
inside the second part of the 'if' too...

Otherwise, if messages 100, 101, 102, 103, and 104
are in fact duplicates, you compute the md5sums for

100, 101, 100, 102, 100, 103, 100, 104, 101, 102, 101, 103,

And so on.  That way you only do N md5sums, not (N+1)*N/2  which is a lot
different for N=4,000.. ;)

_______________________________________________
Nmh-workers mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/nmh-workers
signature.asc (application/pgp-signature, 226 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Exmh version 2.5 07/13/2001

iD8DBQFIxquGcC3lWbTT17ARAlypAJ9IDo0gR6/d2BAUZ533bRK+9AjgUACgtGNQ
nYUA/qtLzrxt6i+eexSlSbw=
=N8fu
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.