From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: 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.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id D2D2F1FA10 for ; Fri, 13 Nov 2020 11:11:44 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 3/4] *index: discard sync->{todo} on iteration Date: Fri, 13 Nov 2020 11:11:43 +0000 Message-Id: <20201113111144.23038-4-e@80x24.org> In-Reply-To: <20201113111144.23038-1-e@80x24.org> References: <20201113111144.23038-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: There's no need to continuously append to {todo} when indexing multiple inboxes. They're not redundantly indexed (because the IdxStack is discarded, making it a noop), but it's still a waste of memory keeping the $unit hashrefs around. --- lib/PublicInbox/ExtSearchIdx.pm | 2 +- lib/PublicInbox/V2Writable.pm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/PublicInbox/ExtSearchIdx.pm b/lib/PublicInbox/ExtSearchIdx.pm index 2d230dc1..6c09c460 100644 --- a/lib/PublicInbox/ExtSearchIdx.pm +++ b/lib/PublicInbox/ExtSearchIdx.pm @@ -308,7 +308,7 @@ sub _sync_inbox ($$$) { warn "E: $ekey unsupported inbox version (v$v)\n"; return; } - index_todo($self, $sync, $_) for @{$sync->{todo}}; + index_todo($self, $sync, $_) for @{delete($sync->{todo}) // []}; } sub eidx_sync { # main entry point diff --git a/lib/PublicInbox/V2Writable.pm b/lib/PublicInbox/V2Writable.pm index cf44c95b..11cde627 100644 --- a/lib/PublicInbox/V2Writable.pm +++ b/lib/PublicInbox/V2Writable.pm @@ -1351,7 +1351,7 @@ sub index_sync { } } # work forwards through history - index_todo($self, $sync, $_) for @{$sync->{todo}}; + index_todo($self, $sync, $_) for @{delete($sync->{todo}) // []}; $self->{oidx}->rethread_done($opt); $self->done;