From: Eric Wong Date: Mon, 6 Jul 2015 21:22:22 +0000 (+0000) Subject: feed: compile regexps only once X-Git-Tag: v1.0.0~1078 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=49338dea67712c0106c09d871fca7d680c32298f;p=thirdparty%2Fpublic-inbox.git feed: compile regexps only once This avoids some runtime penalties associated with recompiling a regexp based on a constant local variable. --- diff --git a/lib/PublicInbox/Feed.pm b/lib/PublicInbox/Feed.pm index dd9915324..3c0ec86d4 100644 --- a/lib/PublicInbox/Feed.pm +++ b/lib/PublicInbox/Feed.pm @@ -168,14 +168,14 @@ sub each_recent_blob { } } elsif ($line =~ /$delmsg/o) { $deleted{$1} = 1; - } elsif ($line =~ /^commit (${hex}{7,40})/) { + } elsif ($line =~ /^commit (${hex}{7,40})/o) { push @commits, $1; } } if ($last) { while (my $line = <$log>) { - if ($line =~ /^commit (${hex}{7,40})/) { + if ($line =~ /^commit (${hex}{7,40})/o) { push @commits, $1; last; }