1 # Copyright (C) 2016-2019 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 $pi_dir = $ENV{GIANT_PI_DIR};
11 plan skip_all => "GIANT_PI_DIR not defined for $0" unless $pi_dir;
12 my $ibx = PublicInbox::Inbox->new({ inboxdir => $pi_dir });
13 eval { require PublicInbox::Search };
14 my $srch = $ibx->search;
15 plan skip_all => "$pi_dir not configured for search $0 $@" unless $srch;
17 require PublicInbox::View;
20 my $elapsed = timeit(1, sub {
21 $msgs = $srch->{over_ro}->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({-inbox => $ibx}, $msgs);
30 diag "thread_results ".timestr($elapsed);