[libvirt] [PATCH] tests: improve build time for qemuxml2argvtest

Daniel P. Berrangé posted 1 patch 1 week ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20191127162242.3711227-1-berrange@redhat.com
tests/qemuxml2argvtest.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

[libvirt] [PATCH] tests: improve build time for qemuxml2argvtest

Posted by Daniel P. Berrangé 1 week ago
On Fedora 31 with GCC 9.2.1, compiling qemuxml2argvtest takes
about 36 seconds since

  commit 30c6d99209cd36bba8e14795622f658827698522
  Author: Jiri Denemark <jdenemar@redhat.com>
  Date:   Thu Oct 24 17:51:42 2019 +0200

    qemuxml2argvtest: Update host arch for DO_TEST*ARCH* tests

The optimizer is hitting some pathelogical performance behaviour due to
the high number of branches in the mymain() method.

Pushing the branch tests down into the testCompareXMLToArgv method
brings the compile time down to 3 seconds.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 tests/qemuxml2argvtest.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index a2791d0460..86b8899921 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -412,6 +412,9 @@ testCompareXMLToArgv(const void *data)
     size_t i;
     qemuDomainObjPrivatePtr priv = NULL;
 
+    if (info->arch != VIR_ARCH_NONE && info->arch != VIR_ARCH_X86_64)
+        qemuTestSetHostArch(driver.caps, info->arch);
+
     memset(&monitor_chr, 0, sizeof(monitor_chr));
 
     if (!(conn = virGetConnect()))
@@ -580,6 +583,9 @@ testCompareXMLToArgv(const void *data)
     virSetConnectStorage(NULL);
     virObjectUnref(conn);
     VIR_FREE(migrateURI);
+    if (info->arch != VIR_ARCH_NONE && info->arch != VIR_ARCH_X86_64)
+        qemuTestSetHostArch(driver.caps, VIR_ARCH_NONE);
+
     return ret;
 }
 
@@ -699,13 +705,9 @@ mymain(void)
                                 __VA_ARGS__, ARG_END) < 0) \
             return EXIT_FAILURE; \
         testInfoSetPaths(&info, _suffix); \
-        if (info.arch != VIR_ARCH_NONE && info.arch != VIR_ARCH_X86_64) \
-            qemuTestSetHostArch(driver.caps, info.arch); \
         if (virTestRun("QEMU XML-2-ARGV " _name _suffix, \
                        testCompareXMLToArgv, &info) < 0) \
             ret = -1; \
-        if (info.arch != VIR_ARCH_NONE && info.arch != VIR_ARCH_X86_64) \
-            qemuTestSetHostArch(driver.caps, VIR_ARCH_NONE); \
         testQemuInfoClear(&info); \
     } while (0)
 
-- 
2.23.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] tests: improve build time for qemuxml2argvtest

Posted by Ján Tomko 1 week ago
On Wed, Nov 27, 2019 at 04:22:42PM +0000, Daniel P. Berrangé wrote:
>On Fedora 31 with GCC 9.2.1, compiling qemuxml2argvtest takes
>about 36 seconds since
>
>  commit 30c6d99209cd36bba8e14795622f658827698522
>  Author: Jiri Denemark <jdenemar@redhat.com>
>  Date:   Thu Oct 24 17:51:42 2019 +0200
>
>    qemuxml2argvtest: Update host arch for DO_TEST*ARCH* tests
>
>The optimizer is hitting some pathelogical performance behaviour due to

*pathological

>the high number of branches in the mymain() method.
>

Missing bugzilla link:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58479

>Pushing the branch tests down into the testCompareXMLToArgv method
>brings the compile time down to 3 seconds.
>

-fno-var-tracking-assignments brings it down even more for me

Can we turn the flag off for tests?

Jano

>Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
>---
> tests/qemuxml2argvtest.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] tests: improve build time for qemuxml2argvtest

Posted by Michal Privoznik 1 week ago
On 11/27/19 8:38 PM, Ján Tomko wrote:
> On Wed, Nov 27, 2019 at 04:22:42PM +0000, Daniel P. Berrangé wrote:
>> On Fedora 31 with GCC 9.2.1, compiling qemuxml2argvtest takes
>> about 36 seconds since
>>
>>  commit 30c6d99209cd36bba8e14795622f658827698522
>>  Author: Jiri Denemark <jdenemar@redhat.com>
>>  Date:   Thu Oct 24 17:51:42 2019 +0200
>>
>>    qemuxml2argvtest: Update host arch for DO_TEST*ARCH* tests
>>
>> The optimizer is hitting some pathelogical performance behaviour due to
> 
> *pathological
> 
>> the high number of branches in the mymain() method.
>>
> 
> Missing bugzilla link:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58479
> 
>> Pushing the branch tests down into the testCompareXMLToArgv method
>> brings the compile time down to 3 seconds.
>>
> 
> -fno-var-tracking-assignments brings it down even more for me
> 
> Can we turn the flag off for tests?

Don't that hurt us when trying to debug tests?

Michal

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] tests: improve build time for qemuxml2argvtest

Posted by Daniel P. Berrangé 1 week ago
On Thu, Nov 28, 2019 at 11:06:12AM +0100, Michal Privoznik wrote:
> On 11/27/19 8:38 PM, Ján Tomko wrote:
> > On Wed, Nov 27, 2019 at 04:22:42PM +0000, Daniel P. Berrangé wrote:
> > > On Fedora 31 with GCC 9.2.1, compiling qemuxml2argvtest takes
> > > about 36 seconds since
> > > 
> > >  commit 30c6d99209cd36bba8e14795622f658827698522
> > >  Author: Jiri Denemark <jdenemar@redhat.com>
> > >  Date:   Thu Oct 24 17:51:42 2019 +0200
> > > 
> > >    qemuxml2argvtest: Update host arch for DO_TEST*ARCH* tests
> > > 
> > > The optimizer is hitting some pathelogical performance behaviour due to
> > 
> > *pathological
> > 
> > > the high number of branches in the mymain() method.
> > > 
> > 
> > Missing bugzilla link:
> > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58479
> > 
> > > Pushing the branch tests down into the testCompareXMLToArgv method
> > > brings the compile time down to 3 seconds.
> > > 
> > 
> > -fno-var-tracking-assignments brings it down even more for me
> > 
> > Can we turn the flag off for tests?
> 
> Don't that hurt us when trying to debug tests?

That seems to be the implication from the info pages on this
option

     Annotate assignments to user variables early in the compilation and
     attempt to carry the annotations over throughout the compilation
     all the way to the end, in an attempt to improve debug information
     while optimizing.  Use of '-gdwarf-4' is recommended along with it.

Even with this enabled by default it is quite painful debugging due
to variables being optimized out, so I'm loathe to make it worse
just to shave off a few seconds.

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] tests: improve build time for qemuxml2argvtest

Posted by Daniel Henrique Barboza 1 week ago

On 11/27/19 1:22 PM, Daniel P. Berrangé wrote:
> On Fedora 31 with GCC 9.2.1, compiling qemuxml2argvtest takes
> about 36 seconds since
> 
>    commit 30c6d99209cd36bba8e14795622f658827698522
>    Author: Jiri Denemark <jdenemar@redhat.com>
>    Date:   Thu Oct 24 17:51:42 2019 +0200
> 
>      qemuxml2argvtest: Update host arch for DO_TEST*ARCH* tests
> 
> The optimizer is hitting some pathelogical performance behaviour due to
> the high number of branches in the mymain() method.
> 
> Pushing the branch tests down into the testCompareXMLToArgv method
> brings the compile time down to 3 seconds.
> 
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---


In my Fedora 31 box, 'make' time of qemuxml2argvtest.c with this patch:

real	0m4.113s
user	0m3.838s
sys	0m0.360s


Without it:


real	0m35.099s
user	0m34.573s
sys	0m0.544s



Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>


--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list