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-ASN: X-Spam-Status: No, score=-4.2 required=3.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, T_SCC_BODY_TEXT_LINE 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 D78211F625 for ; Sat, 10 Sep 2022 08:18:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1662797933; bh=AQgqm+hPgR3KcbsMHjsOzkPi/2RJeNRQY5A456lm1DQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=z3OWIWzGuD4L6UkzgBAureW+AZBSIM9uOdCjRExcsb236SHUBwuZchp8UwMWcbhMV 5dPy8N0mEHk40uQgY+QXEnTHtNnVABpQCfY7WertsEON/xKHzsgbq0xrRJ3xlfAlkh K60ZrvljD20dMdaDOZ/gaXqd2xRgo4PQ26Cubfks= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 12/38] view: eml_entry: reduce manipulation of ctx->{obuf} Date: Sat, 10 Sep 2022 08:17:03 +0000 Message-Id: <20220910081729.2011934-13-e@80x24.org> In-Reply-To: <20220910081729.2011934-1-e@80x24.org> References: <20220910081729.2011934-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: This is another step towards avoid unnecessary copies and pad space waste. --- lib/PublicInbox/View.pm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm index 3980ed91..37b484ae 100644 --- a/lib/PublicInbox/View.pm +++ b/lib/PublicInbox/View.pm @@ -246,11 +246,11 @@ sub eml_entry { $ctx->{mhref} = $mhref; $ctx->{changed_href} = "#e$id"; # for diffstat "files? changed," $ctx->{obuf} = \$rv; - $eml->each_part(\&add_text_body, $ctx, 1); - delete $ctx->{obuf}; + $eml->each_part(\&add_text_body, $ctx, 1); # expensive + $ctx->zmore; # TODO: remove once add_text_body is updated # add the footer - $rv .= "\n^ ". + $rv = "\n^ ". "permalink" . " raw" . " reply"; @@ -388,7 +388,8 @@ sub pre_thread { # walk_thread callback sub thread_eml_entry { my ($ctx, $eml) = @_; my ($beg, $end) = thread_adj_level($ctx, $ctx->{level}); - $beg . '
' . eml_entry($ctx, $eml) . '
' . $end; + $ctx->zmore($beg.'
');
+	eml_entry($ctx, $eml) . '
' . $end; } sub next_in_queue ($$) {