diff options
author | Eric Wong <e@80x24.org> | 2022-09-10 08:17:19 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2022-09-10 19:50:48 +0000 |
commit | ab9c03ff4aa369b397dc1a8c8936153c8565fd05 (patch) | |
tree | 8bc61ae89d8f967ea948918d0478db291011d159 /lib/PublicInbox/Mbox.pm | |
parent | f32456e0d0f4a7756fcc17c83ccf5b682cb512d9 (diff) | |
download | public-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.pm | 2 |
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 |