about summary refs log tree commit homepage
path: root/t/perf-threading.t
diff options
context:
space:
mode:
authorEric Wong (Contractor, The Linux Foundation) <e@80x24.org>2018-04-03 11:09:07 +0000
committerEric Wong (Contractor, The Linux Foundation) <e@80x24.org>2018-04-03 12:06:10 +0000
commite932bd748750234331d5664873272e0cb7ba6025 (patch)
treea847b121826a1b6ae7e58907e3898e0b3c2924ad /t/perf-threading.t
parent525ba4a6a1289d171a879d9e5d4797183a96ed70 (diff)
downloadpublic-inbox-e932bd748750234331d5664873272e0cb7ba6025.tar.gz
There'll be more performance-related tests in the future.
Diffstat (limited to 't/perf-threading.t')
-rw-r--r--t/perf-threading.t32
1 files changed, 32 insertions, 0 deletions
diff --git a/t/perf-threading.t b/t/perf-threading.t
new file mode 100644
index 00000000..15779c93
--- /dev/null
+++ b/t/perf-threading.t
@@ -0,0 +1,32 @@
+# Copyright (C) 2016-2018 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
+use strict;
+use warnings;
+use Test::More;
+use Benchmark qw(:all);
+use PublicInbox::Inbox;
+my $pi_dir = $ENV{GIANT_PI_DIR};
+plan skip_all => "GIANT_PI_DIR not defined for $0" unless $pi_dir;
+my $ibx = PublicInbox::Inbox->new({ mainrepo => $pi_dir });
+eval { require PublicInbox::Search };
+my $srch = $ibx->search;
+plan skip_all => "$pi_dir not configured for search $0 $@" unless $srch;
+
+require PublicInbox::View;
+
+my $msgs;
+my $elapsed = timeit(1, sub {
+        $msgs = $srch->{over_ro}->recent({limit => 200000});
+});
+my $n = scalar(@$msgs);
+ok($n, 'got some messages');
+diag "enquire: ".timestr($elapsed)." for $n";
+
+$elapsed = timeit(1, sub {
+        PublicInbox::View::thread_results({-inbox => $ibx}, $msgs);
+});
+diag "thread_results ".timestr($elapsed);
+
+done_testing();