6ae9ed
From de0ffc327adf837d9daf7577421f9d50bf754077 Mon Sep 17 00:00:00 2001
6ae9ed
Message-Id: <de0ffc327adf837d9daf7577421f9d50bf754077@dist-git>
6ae9ed
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
6ae9ed
Date: Tue, 28 Jun 2016 15:23:58 +0200
6ae9ed
Subject: [PATCH] hvsupport: skip non-matching lines early
6ae9ed
6ae9ed
Most of the lines we look at are not going to match one of the
6ae9ed
driver types contained in $groups_regex.
6ae9ed
6ae9ed
Move on to the next line if it does not contain any of them early.
6ae9ed
This speeds up the script execution by 50%, since this simple regex
6ae9ed
does not have any capture groups.
6ae9ed
6ae9ed
(cherry picked from commit f1bbf57caddaddeea1141bfab9699a709aa303eb)
6ae9ed
6ae9ed
https://bugzilla.redhat.com/show_bug.cgi?id=1286679
6ae9ed
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
6ae9ed
---
6ae9ed
 docs/hvsupport.pl | 3 +++
6ae9ed
 1 file changed, 3 insertions(+)
6ae9ed
6ae9ed
diff --git a/docs/hvsupport.pl b/docs/hvsupport.pl
6ae9ed
index fca83ca..2ead2cf 100755
6ae9ed
--- a/docs/hvsupport.pl
6ae9ed
+++ b/docs/hvsupport.pl
6ae9ed
@@ -212,6 +212,9 @@ foreach my $src (@srcs) {
6ae9ed
     my $impl;
6ae9ed
     while (defined($line = <FILE>)) {
6ae9ed
         if (!$ingrp) {
6ae9ed
+            # skip non-matching lines early to save time
6ae9ed
+            next if not $line =~ /$groups_regex/;
6ae9ed
+
6ae9ed
             if ($line =~ /^\s*(?:static\s+)?($groups_regex)\s+(\w+)\s*=\s*{/ ||
6ae9ed
                 $line =~ /^\s*(?:static\s+)?($groups_regex)\s+NAME\(\w+\)\s*=\s*{/) {
6ae9ed
                 $ingrp = $1;
6ae9ed
-- 
6ae9ed
2.9.2
6ae9ed