Re: [PATCH v4 00/26] scripts: convert most perl scripts to python

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Oct 09, 2019 at 12:37:15PM +0100, Daniel P. Berrangé wrote:
Note that the check-spacing.py script is significantly
slower in Python than in Perl. After researching this
it appears there is nothing that can be done. The Perl
regex engine is simply much better optimized than the
Python one.

I'm afraid immutability of strings does not help either.
I tried speeding it up a bit by running the regexes conditionally, e.g.:

+            if '"' in data:
+                data = quotedstringprog.sub('"XXX"', data)

That got it down from 0m6.368s to 0m3.802s (compared to perl's 1.5s),
but even before that change, I don't consider the Python version of this
one script to be more readable.

Note that perl's optimizations aren't perfect either - merely
moving all the checks into a subroutine resulted in a significant
slowdown.

As previously discussed we need to loook
at uncrustify or clang-format or some other tool to
validate whitespace formatting. This is ongoing. We
can either accept the slow down in the short term or
keep the Perl version in the short term.


Just to set the expectations, running clang-format on all the
C files took me ~40 s. Not sure how much that can be efficiently
parallelized or if meson could be convinced to start clang-format
as the first thing for the 'check' target, even before starting
to compile anything.

Jano

Attachment: signature.asc
Description: PGP signature

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

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux