diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2020-08-17 15:33:39 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2020-08-18 08:11:25 +0200 |
commit | cbde13850f1334ef3019288096ccd95dfcdaec6e (patch) | |
tree | 781460b9ac6981960669bebe68067b1af8ecdb12 | |
parent | b14601da7b42f2b68bb098fc04e267a390f201c2 (diff) | |
download | meson-cbde13850f1334ef3019288096ccd95dfcdaec6e.zip meson-cbde13850f1334ef3019288096ccd95dfcdaec6e.tar.gz meson-cbde13850f1334ef3019288096ccd95dfcdaec6e.tar.bz2 |
ninjabackend: avoid lambdas
The lambda in NinjaBuildElement.write is quite expensive, totalling 0.3s
just to do a couple function calls. Since it is used just once, simply
inline it.
On a QEMU build, the total time spent in write from this series goes from
5.321s to 3.238s, though part of it can be attributed to previous patches.
-rw-r--r-- | mesonbuild/backend/ninjabackend.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index fd8be00..3a5c102 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -386,10 +386,9 @@ class NinjaBuildElement: newelems = [] for i in elems: if not should_quote or i == '&&': # Hackety hack hack - quoter = ninja_quote + newelems.append(ninja_quote(i)) else: - quoter = lambda x: ninja_quote(qf(x)) - newelems.append(quoter(i)) + newelems.append(ninja_quote(qf(i))) line += ' '.join(newelems) line += '\n' outfile.write(line) |