Andy Spencer writes:
I noticed that when using reformail to process messages with large attachments it seems to go unreasonably slow. For a message with a ~20Mb attachment it takes roughly 5 seconds.After reading though the source code it seems that almost all of this time is spent at the end of extract_headers() in reformail.C at the 'while ( Readline() );' line. If it's simply ignoring the output, does it actually need to be read?
Yes. It's reading the message from the mail server. If it terminates without reading it fully, the mail server may conclude that the delivery agent has crashed, and it will requeue the message.
Simply closing standard in saves a significant amount of time. If the
message does need to be read for some reason, then changing:
while ( Readline() );
to
char buf[512];
while ( fread(buf, 512, 1, stdin) == 1 );
or some C++ equivalent decreases the execution time from about 5 seconds
to about 0.05.
Fair enough.
pgp4WEQRQEGeZ.pgp
Description: PGP signature
------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________ courier-users mailing list [email protected] Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users
