From f9d88ea6c375f6f265da1a13025abcc9e38d6839 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 21 Sep 2015 11:11:09 +0000 Subject: nntp: speed up xover slightly Reserializing the message to a string to check size wastes considerable time and should be able to get by with slightly less accuracy. --- lib/PublicInbox/NNTP.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/PublicInbox/NNTP.pm') diff --git a/lib/PublicInbox/NNTP.pm b/lib/PublicInbox/NNTP.pm index d5eb4971..fb93330b 100644 --- a/lib/PublicInbox/NNTP.pm +++ b/lib/PublicInbox/NNTP.pm @@ -366,7 +366,8 @@ find_mid: } found: my $o = 'HEAD:' . mid2path($mid); - my $s = eval { Email::Simple->new($ng->gcf->cat_file($o)) }; + my $bytes; + my $s = eval { Email::Simple->new($ng->gcf->cat_file($o, \$bytes)) }; return $err unless $s; if ($set_headers) { $s->header_set('Newsgroups', $ng->{name}); @@ -375,7 +376,7 @@ found: # must be last if ($set_headers == 2) { - $s->header_set('Bytes', bytes::length($s->as_string)); + $s->header_set('Bytes', $bytes); $s->body_set(''); } } -- cgit v1.2.3-24-ge0c7