From c5b3d2549596b773d52e5feb947f461630dfe301 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 5 Oct 2016 23:47:18 +0000 Subject: thread: pass array refs instead of entire arrays Copying large arrays is expensive, so avoid it. This reduces /$INBOX/ time by around 1%. --- lib/PublicInbox/SearchView.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/PublicInbox/SearchView.pm') diff --git a/lib/PublicInbox/SearchView.pm b/lib/PublicInbox/SearchView.pm index da311093..0d54c3df 100644 --- a/lib/PublicInbox/SearchView.pm +++ b/lib/PublicInbox/SearchView.pm @@ -156,10 +156,10 @@ sub mset_thread { $th->thread; if ($q->{r}) { # order by relevance $th->order(sub { - sort { (eval { $pct{$b->topmost->messageid} } || 0) + [ sort { (eval { $pct{$b->topmost->messageid} } || 0) <=> (eval { $pct{$a->topmost->messageid} } || 0) - } @_; + } @{$_[0]} ]; }); } else { # order by time (default for threaded view) $th->order(*PublicInbox::View::sort_ts); -- cgit v1.2.3-24-ge0c7