about summary refs log tree commit homepage
path: root/lib/PublicInbox/Mbox.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2022-09-10 08:17:19 +0000
committerEric Wong <e@80x24.org>2022-09-10 19:50:48 +0000
commitab9c03ff4aa369b397dc1a8c8936153c8565fd05 (patch)
tree8bc61ae89d8f967ea948918d0478db291011d159 /lib/PublicInbox/Mbox.pm
parentf32456e0d0f4a7756fcc17c83ccf5b682cb512d9 (diff)
downloadpublic-inbox-ab9c03ff4aa369b397dc1a8c8936153c8565fd05.tar.gz
Calling Compress::Raw::Zlib::deflate is fairly expensive.
Relying on the `.=' (concat) operator inside ->zadd operator is
faster, but the method dispatch overhead is noticeable compared
to the original code where we had bare `.=' littered throughout.

Fortunately, `print' and `say' with the PerlIO::scalar IO layer
appears to offer better performance without high method dispatch
overhead.  This doesn't allow us to save as much memory as I
originally hoped, but does allow us to rely less on concat
operators in other places and just pass a list of args to
`print' and `say' as a appropriate.

This does reduce scratchpad use, however, allowing for large
memory savings, and we still ->deflate every single $eml.
Diffstat (limited to 'lib/PublicInbox/Mbox.pm')
-rw-r--r--lib/PublicInbox/Mbox.pm2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/PublicInbox/Mbox.pm b/lib/PublicInbox/Mbox.pm
index cfe34d9c..2ef8ff2b 100644
--- a/lib/PublicInbox/Mbox.pm
+++ b/lib/PublicInbox/Mbox.pm
@@ -20,7 +20,7 @@ sub getline {
         my $ibx = $ctx->{ibx};
         my $eml = delete($ctx->{eml}) // $ibx->smsg_eml($smsg) // return;
         my $n = $ctx->{smsg} = $ibx->over->next_by_mid(@{$ctx->{next_arg}});
-        $ctx->zadd(msg_hdr($ctx, $eml));
+        $ctx->zmore(msg_hdr($ctx, $eml));
         if ($n) {
                 $ctx->translate(msg_body($eml));
         } else { # last message