path: root/meta/recipes-kernel/linux/
diff options
authorEtienne Cordonnier <>2023-02-01 14:19:00 (GMT)
committerRichard Purdie <>2023-02-04 17:03:15 (GMT)
commitedb60ef6fd49764174d140ccae04fca65db131e0 (patch)
tree3945abb66359a2f0a35ada60f1d04aa5c1ff1106 /meta/recipes-kernel/linux/
parentde41e1737b6014f651ad8beb08519b3ccbcc34d1 (diff)
bitbake: siggen: Fix inefficient string concatenationHEADmaster
As discussed in , CPython has an optimization for statements in the form "a = a + b" or "a += b". It seems that this line does not get optimized, because it has a form a = a + b + c: data = data + "./" + f.split("/./")[1] For that reason, it does a copy of data for each iteration, potentially copying megabytes of data for each iteration. Changing this line causes SignatureGeneratorBasic::get_taskhash to take 0.06 seconds instead of 45 seconds on my test setup where SRC_URI points to a big directory. Note that PEP8 recommends explicitely not to use this optimization which is specific to CPython: "do not rely on CPython’s efficient implementation of in-place string concatenation for statements in the form a += b or a = a + b" However, the PEP8 recommended form using "join()" also does not avoid the copy and takes 45 seconds in my test setup: data = ''.join((data, "./", f.split("/./")[1])) I have changed the other lines to also use += for consistency only, however those were in the form a = a + b and were optimized already. Co-authored-by: JJ Robertson <> (Bitbake rev: 195750f2ca355e29d51219c58ecb2c1d83692717) Signed-off-by: Etienne Cordonnier <> Signed-off-by: Richard Purdie <>
Diffstat (limited to 'meta/recipes-kernel/linux/')
0 files changed, 0 insertions, 0 deletions