diff options
author | Eric Wong <e@80x24.org> | 2020-09-17 08:57:51 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2020-09-18 01:21:15 +0000 |
commit | 05fe38843c2e13cd0c368f8dd7501e4e57c3a829 (patch) | |
tree | 007958b34ba5fcee37d94559729f4f242f6d38c8 | |
parent | 31065006a3654968c0c4bbfe2d7399a3b326ce18 (diff) | |
download | public-inbox-05fe38843c2e13cd0c368f8dd7501e4e57c3a829.tar.gz |
$git->cat_async already calls $git->batch_prepare iff needed, so we can reduce subroutine calls and inline a one-off subroutine to save some memory, here.
-rw-r--r-- | lib/PublicInbox/GitAsyncCat.pm | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/lib/PublicInbox/GitAsyncCat.pm b/lib/PublicInbox/GitAsyncCat.pm index 5f785df7..db1a7f94 100644 --- a/lib/PublicInbox/GitAsyncCat.pm +++ b/lib/PublicInbox/GitAsyncCat.pm @@ -14,14 +14,6 @@ use parent qw(PublicInbox::DS Exporter); use PublicInbox::Syscall qw(EPOLLIN EPOLLET); our @EXPORT = qw(git_async_cat); -sub _add { - my ($class, $git) = @_; - $git->batch_prepare; - my $self = bless { git => $git }, $class; - $self->SUPER::new($git->{in}, EPOLLIN|EPOLLET); - \undef; # this is a true ref() -} - sub event_step { my ($self) = @_; my $git = $self->{git}; @@ -36,7 +28,11 @@ sub event_step { sub git_async_cat ($$$$) { my ($git, $oid, $cb, $arg) = @_; $git->cat_async($oid, $cb, $arg); - $git->{async_cat} //= _add(__PACKAGE__, $git); + $git->{async_cat} //= do { + my $self = bless { git => $git }, __PACKAGE__; + $self->SUPER::new($git->{in}, EPOLLIN|EPOLLET); + \undef; # this is a true ref() + }; } 1; |