Hi,

Just wanted to know what the qp gurus think about applying the following patch to queue/qmail-queue

Instead of writing the message line by line (depending on perl doing command-queueing for the prints), it just does it in chunks. That way the code doesn't have to scan for the newlines, saving what looks like lots of CPU cycles in calls and string scanning (very rough eye-estimation).

Will doing this affect neagtively the other Transaction.pm body_xxx methods?

I have tried this plugin on a dev forkserver, and messages have been queued without problems. Not tried in production machines, though.

Also: I chose 4KB chunks because that seems the buffer size of lots of devices. Any pointers on the recommended way of retrieving a better buffer size from body_fh, for example?

Best Regards,

Jose Luis Martinez
[EMAIL PROTECTED]
CAPSiDE

--- qmail-queue 2008-05-08 14:06:22.000000000 +0200
+++ qmail-queue_opt     2008-05-20 12:59:55.000000000 +0200
@@ -58,9 +58,17 @@

     $transaction->header->print(\*MESSAGE_WRITER);
     $transaction->body_resetpos;
-    while (my $line = $transaction->body_getline) {
-      print MESSAGE_WRITER $line;
+    my $input = $transaction->body_fh;
+    my $buf;
+
+    while (read($input, $buf, 4096)) {
+        print MESSAGE_WRITER $buf;
     }
+
+#    while (my $line = $transaction->body_getline) {
+#      print MESSAGE_WRITER $line;
+#    }
     close MESSAGE_WRITER;

     my @rcpt = map { "T" . $_->address } $transaction->recipients;

Reply via email to