1 # Copyright (C) 2016-2021 all contributors <meta@public-inbox.org>
2 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
4 # real-world testing of search threading
8 use Benchmark qw(:all);
9 use PublicInbox::Inbox;
10 my $inboxdir = $ENV{GIANT_INBOX_DIR} // $ENV{GIANT_PI_DIR};
11 plan skip_all => "GIANT_INBOX_DIR not defined for $0" unless $inboxdir;
12 my $ibx = PublicInbox::Inbox->new({ inboxdir => $inboxdir });
13 eval { require PublicInbox::Search };
14 my $srch = $ibx->search;
15 plan skip_all => "$inboxdir not configured for search $0 $@" unless $srch;
17 require PublicInbox::View;
20 my $elapsed = timeit(1, sub {
21 $msgs = $ibx->over->recent({limit => 200000});
23 my $n = scalar(@$msgs);
24 ok($n, 'got some messages');
25 diag "enquire: ".timestr($elapsed)." for $n";
27 $elapsed = timeit(1, sub {
28 PublicInbox::View::thread_results({ibx => $ibx}, $msgs);
30 diag "thread_results ".timestr($elapsed);