]> xenbits.xensource.com Git - libvirt.git/commit
hvsupport: construct the group regex upfront
authorJán Tomko <jtomko@redhat.com>
Tue, 28 Jun 2016 13:16:01 +0000 (15:16 +0200)
committerJán Tomko <jtomko@redhat.com>
Tue, 19 Jul 2016 16:50:13 +0000 (18:50 +0200)
commit6dc1f103471518a7f7e2fefaf8f631eb6f2ca922
treea87c10f7bf4376abc60b8f87dbbc2bba141b4ce9
parentad9e72f5fa118d97abe60a0ea6e5dba195476fc7
hvsupport: construct the group regex upfront

The %groups hash contains all the driver types (e.g.
virHypervisorDriver or virSecretDriver).

When searching for all the APIs that are implemented by a driver
of that specific driver type, we keep iterating over the %groups
hash on every line we look at, then matching against the driver type.

This is inefficient because it prevents perl from caching the regex
and it executes the regex once for every driver type, even though
one regex matching excludes all the others, since all the driver types
are different.

Construct the regex containing all the driver types upfront to save
about 6.4s (~98%) of the script execution time.
docs/hvsupport.pl