From bb3e51c9fdaf1059c2ae8368a527b4bd87b0b423 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 10 Sep 2022 08:16:52 +0000 Subject: xt: fold perf-obfuscate into perf-msgview, future-proof perf-obfuscate was close enough to perf-msgview that it only required setting the `obfuscate' field of the inbox. Then update perf-msgview to account for upcoming internal changes. The current use of {obuf} and concat ops results in excessive scratchpad space and I may be able to even get speedups by avoiding concat ops. --- xt/perf-msgview.t | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'xt/perf-msgview.t') diff --git a/xt/perf-msgview.t b/xt/perf-msgview.t index 7f92ce85..ef261359 100644 --- a/xt/perf-msgview.t +++ b/xt/perf-msgview.t @@ -11,6 +11,8 @@ use PublicInbox::WwwStream; my $inboxdir = $ENV{GIANT_INBOX_DIR} // $ENV{GIANT_PI_DIR}; my $blob = $ENV{TEST_BLOB}; +my $obfuscate = $ENV{PI_OBFUSCATE} ? 1 : 0; +diag "PI_OBFUSCATE=$obfuscate"; plan skip_all => "GIANT_INBOX_DIR not defined for $0" unless $inboxdir; my @cat = qw(cat-file --buffer --batch-check --batch-all-objects); @@ -21,7 +23,8 @@ if (require_git(2.19, 1)) { "git <2.19, cat-file lacks --unordered, locality suffers\n"; } require_mods qw(Plack::Util); -my $ibx = PublicInbox::Inbox->new({ inboxdir => $inboxdir, name => 'name' }); +my $ibx = PublicInbox::Inbox->new({ inboxdir => $inboxdir, name => 'name', + obfuscate => $obfuscate}); my $git = $ibx->git; my $fh = $blob ? undef : $git->popen(@cat); if ($fh) { @@ -46,10 +49,11 @@ $ctx->{mhref} = '../'; my $cb = sub { $eml = PublicInbox::Eml->new(shift); $eml->each_part(\&PublicInbox::View::add_text_body, $ctx, 1); - $ctx->zflush; + $ctx->zflush(grep defined, delete @$ctx{'obuf'}); # compat ++$m; delete $ctx->{zbuf}; - ${$ctx->{obuf}} = ''; + ${$ctx->{obuf}} = ''; # compat + $ctx->{gz} = PublicInbox::GzipFilter::gzip_or_die(); }; my $t = timeit(1, sub { -- cgit v1.2.3-24-ge0c7