aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2020-08-17 15:33:39 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2020-08-18 08:11:25 +0200
commitcbde13850f1334ef3019288096ccd95dfcdaec6e (patch)
tree781460b9ac6981960669bebe68067b1af8ecdb12
parentb14601da7b42f2b68bb098fc04e267a390f201c2 (diff)
downloadmeson-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.py5
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)