From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-3.8 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, RP_MATCHES_RCVD shortcircuit=no autolearn=unavailable version=3.3.2 X-Original-To: meta@public-inbox.org Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id DB0A120317 for ; Tue, 14 Jul 2015 20:59:50 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH] feed: compile regexps only once Date: Tue, 14 Jul 2015 20:59:50 +0000 Message-Id: <1436907590-30838-1-git-send-email-e@80x24.org> List-Id: This avoids some runtime penalties associated with recompiling a regexp based on a constant local variable. --- lib/PublicInbox/Feed.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/PublicInbox/Feed.pm b/lib/PublicInbox/Feed.pm index dd99153..3c0ec86 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; } -- EW