user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH 1/2] searchthread: remove + inline single-use cast sub
  2022-06-22  8:02  5% [PATCH 0/2] searchthread: minor simplifications Eric Wong
@ 2022-06-22  8:02  7% ` Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2022-06-22  8:02 UTC (permalink / raw)
  To: meta

No point in wasting several kilobytes of memory for a single-use
one-line sub.
---
 lib/PublicInbox/SearchThread.pm | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/lib/PublicInbox/SearchThread.pm b/lib/PublicInbox/SearchThread.pm
index f07dd696..cc8c90ce 100644
--- a/lib/PublicInbox/SearchThread.pm
+++ b/lib/PublicInbox/SearchThread.pm
@@ -38,13 +38,13 @@ sub thread {
 		# TODO: move this to a more appropriate place, breaks tests
 		# if we do it during psgi_cull
 		delete $_->{num};
-
-		PublicInbox::SearchThread::Msg::cast($_);
+		bless $_, 'PublicInbox::SearchThread::Msg';
 		if (exists $id_table{$_->{mid}}) {
 			$_->{children} = [];
 			push @imposters, $_; # we'll deal with them later
 			undef;
 		} else {
+			$_->{children} = {}; # will become arrayref later
 			$id_table{$_->{mid}} = $_;
 			defined($_->{references});
 		}
@@ -108,13 +108,6 @@ sub ghost {
 	}, __PACKAGE__;
 }
 
-# give a existing smsg the methods of this class
-sub cast {
-	my ($smsg) = @_;
-	$smsg->{children} = {};
-	bless $smsg, __PACKAGE__;
-}
-
 sub topmost {
 	my ($self) = @_;
 	my @q = ($self);

^ permalink raw reply related	[relevance 7%]

* [PATCH 0/2] searchthread: minor simplifications
@ 2022-06-22  8:02  5% Eric Wong
  2022-06-22  8:02  7% ` [PATCH 1/2] searchthread: remove + inline single-use cast sub Eric Wong
  0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2022-06-22  8:02 UTC (permalink / raw)
  To: meta

A few patches I've had floating around since last Nov before
I completely forgot about some things :x

Eric Wong (2):
  searchthread: remove + inline single-use cast sub
  searchthread: delete children early while ordering

 lib/PublicInbox/SearchThread.pm | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

^ permalink raw reply	[relevance 5%]

Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2022-06-22  8:02  5% [PATCH 0/2] searchthread: minor simplifications Eric Wong
2022-06-22  8:02  7% ` [PATCH 1/2] searchthread: remove + inline single-use cast sub Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).