user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
blob 0f00f48799117b682c891095df5dba6e6f61290f 1160 bytes (raw)
name: xt/perf-imap-list.t 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
 
#!perl -w
# Copyright (C) 2020 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
use Test::More;
use_ok 'PublicInbox::IMAP';
use_ok 'PublicInbox::IMAPD';
use PublicInbox::DS;
use Benchmark qw(:all);
my @n = map { { newsgroup => "inbox.comp.foo.bar.$_" } } (0..50000);
push @n, map { { newsgroup => "xobni.womp.foo.bar.$_" } } (0..50000);
my $self = { imapd => { grouplist => \@n } };
my $n = scalar @n;
my $t = timeit(1, sub {
	PublicInbox::IMAPD::refresh_inboxlist($self->{imapd});
});
diag timestr($t). "refresh $n inboxes";

open my $null, '>', '/dev/null' or BAIL_OUT "open: $!";
my $ds = { sock => $null };
my $nr = 200;
diag "starting benchmark...";
my $cmd_list = \&PublicInbox::IMAP::cmd_list;
$t = timeit(1, sub {
	for (0..$nr) {
		my $res = $cmd_list->($self, 'tag', '', '*');
		PublicInbox::DS::write($ds, $res);
	}
});
diag timestr($t). "list all for $n inboxes $nr times";
$nr = 20;
$t = timeit(1, sub {
	for (0..$nr) {
		my $res = $cmd_list->($self, 'tag', 'inbox.', '%');
		PublicInbox::DS::write($ds, $res);
	}
});
diag timestr($t). "list partial for $n inboxes $nr times";
done_testing;

debug log:

solving 0f00f487991 ...
found 0f00f487991 in https://80x24.org/public-inbox.git

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

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).