user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH 3/6] nntp: speed up xover slightly
  2015-09-21 11:11  6% [PATCH 0/6] more NNTP server updates Eric Wong
@ 2015-09-21 11:11  7% ` Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2015-09-21 11:11 UTC (permalink / raw)
  To: meta

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/GitCatFile.pm | 3 ++-
 lib/PublicInbox/NNTP.pm       | 5 +++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/lib/PublicInbox/GitCatFile.pm b/lib/PublicInbox/GitCatFile.pm
index 4f16762..dd3f291 100644
--- a/lib/PublicInbox/GitCatFile.pm
+++ b/lib/PublicInbox/GitCatFile.pm
@@ -38,7 +38,7 @@ sub _cat_file_begin {
 }
 
 sub cat_file {
-	my ($self, $object) = @_;
+	my ($self, $object, $sizeref) = @_;
 
 	$object .= "\n";
 	my $len = bytes::length($object);
@@ -58,6 +58,7 @@ sub cat_file {
 		die "Unexpected result from git cat-file: $head\n";
 
 	my $size = $1;
+	$$sizeref = $size if $sizeref;
 	my $bytes_left = $size;
 	my $offset = 0;
 	my $rv = '';
diff --git a/lib/PublicInbox/NNTP.pm b/lib/PublicInbox/NNTP.pm
index d5eb497..fb93330 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('');
 		}
 	}
-- 
EW


^ permalink raw reply related	[relevance 7%]

* [PATCH 0/6] more NNTP server updates
@ 2015-09-21 11:11  6% Eric Wong
  2015-09-21 11:11  7% ` [PATCH 3/6] nntp: speed up xover slightly Eric Wong
  0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2015-09-21 11:11 UTC (permalink / raw)
  To: meta

Always finding new bugs.  The XHDR Xref performance improvement
is pretty huge, and the XOVER speedup is noticeable as well.

We will begin to implement RFC 3977, AFAIK the latest NNTP RFC.

Eric Wong (6):
      msgmap: minor cleanup to move constant declaration
      nntp: speed up XHDR Xref for rtin
      nntp: speed up xover slightly
      t/nntpd.t: improve test runnability
      remove bytes:: for length checks
      nntp: proper UTF-8 support (hopefully?)

 lib/PublicInbox/Filter.pm     |  2 +-
 lib/PublicInbox/GitCatFile.pm |  5 +++--
 lib/PublicInbox/Msgmap.pm     |  2 +-
 lib/PublicInbox/NNTP.pm       | 47 ++++++++++++++++++++++++++++++++++++-------
 public-inbox-nntpd            |  4 ++--
 t/nntpd.t                     |  3 ++-
 6 files changed, 49 insertions(+), 14 deletions(-)


^ permalink raw reply	[relevance 6%]

Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2015-09-21 11:11  6% [PATCH 0/6] more NNTP server updates Eric Wong
2015-09-21 11:11  7% ` [PATCH 3/6] nntp: speed up xover slightly Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).