From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 764A4203EA; Tue, 20 Dec 2016 03:04:02 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Cc: Eric Wong Subject: [PATCH 1/2] tests: add thread-all testing for benchmarking Date: Tue, 20 Dec 2016 03:03:56 +0000 Message-Id: <20161220030357.26350-2-e@80x24.org> In-Reply-To: <20161220030357.26350-1-e@80x24.org> References: <20161220030357.26350-1-e@80x24.org> List-Id: I'll be using this to improve message threading performance. --- MANIFEST | 1 + t/thread-all.t | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 t/thread-all.t diff --git a/MANIFEST b/MANIFEST index 3388b1a..8f5e487 100644 --- a/MANIFEST +++ b/MANIFEST @@ -156,6 +156,7 @@ t/qspawn.t t/search.t t/spamcheck_spamc.t t/spawn.t +t/thread-all.t t/thread-cycle.t t/utf8.mbox t/view.t diff --git a/t/thread-all.t b/t/thread-all.t new file mode 100644 index 0000000..8ccf4f8 --- /dev/null +++ b/t/thread-all.t @@ -0,0 +1,38 @@ +# Copyright (C) 2016 all contributors +# License: AGPL-3.0+ +# +# real-world testing of search threading +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 $pfx = PublicInbox::Search::xpfx('thread'); +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"; + +done_testing(); -- EW