[libvirt] [PATCHv2 2/3] hvsupport: construct the group regex upfront

Peter Krempa pkrempa at redhat.com
Wed Jul 20 08:11:55 UTC 2016


On Tue, Jul 19, 2016 at 18:55:53 +0200, Ján Tomko wrote:
> 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 | 33 ++++++++++++++++-----------------
>  1 file changed, 16 insertions(+), 17 deletions(-)

ACK




More information about the libvir-list mailing list