about summary refs log tree commit homepage
path: root/lib/PublicInbox/SearchView.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-10-09 12:03:36 +0000
committerEric Wong <e@80x24.org>2021-10-09 21:31:08 +0000
commit2eac33fffcf1757675a959e69eb34f04e446bd25 (patch)
tree7aee82301cc8dc3f40a409758770307ab4e32af7 /lib/PublicInbox/SearchView.pm
parent394af1500d35c14883d9037b5776687a0a882f35 (diff)
downloadpublic-inbox-2eac33fffcf1757675a959e69eb34f04e446bd25.tar.gz
view: save memory by dropping smsg->{from_name} on use
We'll also save a few LoC when generating it.  $smsg objects can
linger a while when rendering large threads, so saving a few
bytes here can add up to several hundred KB saved.

I noticed this while chasing the ref cycle leak in commit
b28e74c9dc0a (www: fix ref cycle from threading w/ extindex, 2021-10-03).
While there's no longer a leak, releasing memory earlier can
allow it to be reused sooner and reduce both memory traffic and
memory pressure.
Diffstat (limited to 'lib/PublicInbox/SearchView.pm')
-rw-r--r--lib/PublicInbox/SearchView.pm2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/PublicInbox/SearchView.pm b/lib/PublicInbox/SearchView.pm
index 91196cca..e74ddb90 100644
--- a/lib/PublicInbox/SearchView.pm
+++ b/lib/PublicInbox/SearchView.pm
@@ -122,7 +122,7 @@ sub mset_summary {
                 $min = $pct;
 
                 my $s = ascii_html($smsg->{subject});
-                my $f = ascii_html($smsg->{from_name});
+                my $f = ascii_html(delete $smsg->{from_name});
                 if ($obfs_ibx) {
                         obfuscate_addrs($obfs_ibx, $s);
                         obfuscate_addrs($obfs_ibx, $f);