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/4] mid+contenthash: eliminate needless local variable captures
  2023-04-25 10:50  6% [PATCH 0/4] mail diff updates Eric Wong
@ 2023-04-25 10:50  7% ` Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2023-04-25 10:50 UTC (permalink / raw)
  To: meta

It's possible in theory that Perl could be smarter and free
memory a tad sooner this way.  Regardless, fewer lines of code
is easier-to-navigate/read and can save optree size and reduce
parsing times.
---
 lib/PublicInbox/ContentHash.pm | 6 ++----
 lib/PublicInbox/MID.pm         | 6 ++----
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/lib/PublicInbox/ContentHash.pm b/lib/PublicInbox/ContentHash.pm
index d3ff146a..a4f6196f 100644
--- a/lib/PublicInbox/ContentHash.pm
+++ b/lib/PublicInbox/ContentHash.pm
@@ -76,8 +76,7 @@ sub content_digest ($;$) {
 		last;
 	}
 	foreach my $h (qw(Subject Date)) {
-		my @v = $eml->header($h);
-		foreach my $v (@v) {
+		for my $v ($eml->header($h)) {
 			utf8::encode($v);
 			$dig->add("$h\0$v\0");
 		}
@@ -86,8 +85,7 @@ sub content_digest ($;$) {
 	# not in the original message.  For the purposes of deduplication,
 	# do not take it into account:
 	foreach my $h (qw(To Cc)) {
-		my @v = $eml->header($h);
-		digest_addr($dig, $h, $_) foreach @v;
+		digest_addr($dig, $h, $_) for ($eml->header($h));
 	}
 	msg_iter($eml, \&content_dig_i, $dig);
 	$dig;
diff --git a/lib/PublicInbox/MID.pm b/lib/PublicInbox/MID.pm
index 4819cc25..b1ae9939 100644
--- a/lib/PublicInbox/MID.pm
+++ b/lib/PublicInbox/MID.pm
@@ -92,8 +92,7 @@ sub references ($) {
 	my ($hdr) = @_;
 	my @mids;
 	foreach my $f (qw(References In-Reply-To)) {
-		my @v = $hdr->header_raw($f);
-		foreach my $v (@v) {
+		for my $v ($hdr->header_raw($f)) {
 			push(@mids, ($v =~ /$MID_EXTRACT/g));
 		}
 	}
@@ -104,8 +103,7 @@ sub references ($) {
 	my %addr = ( y => 1, n => 1 );
 
 	foreach my $f (qw(To From Cc)) {
-		my @v = $hdr->header_raw($f);
-		foreach my $v (@v) {
+		for my $v ($hdr->header_raw($f)) {
 			$addr{$_} = 1 for (PublicInbox::Address::emails($v));
 		}
 	}

^ permalink raw reply related	[relevance 7%]

* [PATCH 0/4] mail diff updates
@ 2023-04-25 10:50  6% Eric Wong
  2023-04-25 10:50  7% ` [PATCH 1/4] mid+contenthash: eliminate needless local variable captures Eric Wong
  0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2023-04-25 10:50 UTC (permalink / raw)
  To: meta

Some things which I noticed while reading some cross-posted LKML
messages.  These affect the /$INBOX/$MSGID/d/ WWW endpoint as
well as `lei mail-diff'

I'm considering making tweaks to ContentHash to ignore the
name+comment parts of To/Cc headers and only rely on the
lowercased email address itself, too.  That would affect
dedupe across the board for v2 and extindex...

Eric Wong (4):
  mid+contenthash: eliminate needless local variable captures
  mail_diff: match ContentHash EOL and EOM behavior more closely
  mail_diff: show headers differences in WWW /$MSGID/d/ view
  content_digest_dbg: improve display of To:/Cc: diffs

 lib/PublicInbox/ContentDigestDbg.pm |  7 +++++--
 lib/PublicInbox/ContentHash.pm      |  8 +++-----
 lib/PublicInbox/MID.pm              |  6 ++----
 lib/PublicInbox/MailDiff.pm         | 11 ++++-------
 4 files changed, 14 insertions(+), 18 deletions(-)

^ permalink raw reply	[relevance 6%]

Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2023-04-25 10:50  6% [PATCH 0/4] mail diff updates Eric Wong
2023-04-25 10:50  7% ` [PATCH 1/4] mid+contenthash: eliminate needless local variable captures 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).