public-inbox.git  about / heads / tags
an "archives first" approach to mailing lists
blob b1f9b47c0f7a77c9dc32c5ee9fe49b15a9a768c2 1257 bytes (raw)
$ git show repobrowse:t/thread-all.t	# shows this blob on the CLI

 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
39
 
# Copyright (C) 2016 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
#
# real-world testing of search threading performance
use strict;
use warnings;
use Test::More;
use Time::HiRes qw(clock_gettime CLOCK_MONOTONIC);
my $pi_dir = $ENV{GIANT_PI_DIR};
plan skip_all => "GIANT_PI_DIR not defined for $0" unless $pi_dir;
eval { require PublicInbox::Search; };
plan skip_all => "Xapian missing for $0" if $@;
my $srch = eval { PublicInbox::Search->new($pi_dir) };
plan skip_all => "$pi_dir not initialized for $0" if $@;

require PublicInbox::View;
require PublicInbox::SearchThread;

my $opts = { limit => 1000000, asc => 1 };
my $t0 = clock_gettime(CLOCK_MONOTONIC);
my $elapsed;

my $sres = $srch->_do_enquire(undef, $opts);
$elapsed = clock_gettime(CLOCK_MONOTONIC) - $t0;
diag "enquire: $elapsed";

$t0 = clock_gettime(CLOCK_MONOTONIC);
my $msgs = PublicInbox::View::load_results($srch, $sres);
$elapsed = clock_gettime(CLOCK_MONOTONIC) - $t0;
diag "load_results $elapsed";

$t0 = clock_gettime(CLOCK_MONOTONIC);
PublicInbox::View::thread_results($msgs);
$elapsed = clock_gettime(CLOCK_MONOTONIC) - $t0;
diag "thread_results $elapsed";

ok(1, 'test completed without crashing :)');

done_testing();

git clone https://public-inbox.org/public-inbox.git
git clone http://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/public-inbox.git