diff options
author | Eric Wong <e@yhbt.net> | 2020-07-26 06:57:30 +0000 |
---|---|---|
committer | Eric Wong <e@yhbt.net> | 2020-07-26 23:46:39 +0000 |
commit | 27277902f3ddb10af08c9870e3e9af1285e390ce (patch) | |
tree | 1d9f14ee7aa356962720df7d5a38a41f6fb7a1b4 /lib/PublicInbox/IMAP.pm | |
parent | 999e8c1b3d54f4504cd4fa87949a077da325a1af (diff) | |
download | public-inbox-27277902f3ddb10af08c9870e3e9af1285e390ce.tar.gz |
imap: introduce and use Git->async_prefetch
We can keep the git process more active by sending another request to it while fetch_run_ops() is running. This parallelization speeds up mutt's initial FETCH for headers by around ~35%(!).
Diffstat (limited to 'lib/PublicInbox/IMAP.pm')
-rw-r--r-- | lib/PublicInbox/IMAP.pm | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/PublicInbox/IMAP.pm b/lib/PublicInbox/IMAP.pm index 8ab4b1e7..3d66f930 100644 --- a/lib/PublicInbox/IMAP.pm +++ b/lib/PublicInbox/IMAP.pm @@ -626,8 +626,13 @@ sub fetch_blob_cb { # called by git->cat_async via git_async_cat } else { $smsg->{blob} eq $oid or die "BUG: $smsg->{blob} != $oid"; } + my $pre; + if (!$self->{wbuf} && (my $nxt = $msgs->[0])) { + $pre = $self->{ibx}->git->async_prefetch($nxt->{blob}, + \&fetch_blob_cb, $fetch_arg); + } fetch_run_ops($self, $smsg, $bref, $ops, $partial); - requeue_once($self); + $pre ? $self->zflush : requeue_once($self); } sub emit_rfc822 { |