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://www.git.stargrave.org/?a=commitdiff_plain;h=49338dea67712c0106c09d871fca7d680c32298f;p=public-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 dd991532..3c0ec86d 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; }