From: Ján Tomko Date: Tue, 28 Jun 2016 13:23:58 +0000 (+0200) Subject: hvsupport: skip non-matching lines early X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=f1bbf57caddaddeea1141bfab9699a709aa303eb;p=libvirt.git hvsupport: skip non-matching lines early Most of the lines we look at are not going to match one of the driver types contained in $groups_regex. Move on to the next line if it does not contain any of them early. This speeds up the script execution by 50%, since this simple regex does not have any capture groups. --- diff --git a/docs/hvsupport.pl b/docs/hvsupport.pl index fca83ca89a..2ead2cf77c 100755 --- a/docs/hvsupport.pl +++ b/docs/hvsupport.pl @@ -212,6 +212,9 @@ foreach my $src (@srcs) { my $impl; while (defined($line = )) { if (!$ingrp) { + # skip non-matching lines early to save time + next if not $line =~ /$groups_regex/; + if ($line =~ /^\s*(?:static\s+)?($groups_regex)\s+(\w+)\s*=\s*{/ || $line =~ /^\s*(?:static\s+)?($groups_regex)\s+NAME\(\w+\)\s*=\s*{/) { $ingrp = $1;