Skip to contentSkip to conversation

utils: Optimise looping in base_set_filespath

PATCH New Richard Purdie 1 participant 1 message Nov 19, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 utils: Optimise looping in base_set_filespath

Calling split on the same expression, once per loop iteration is inefficient and pointless, particularly in a function called by every recipe during parsing.

---

meta/classes/utils.bbclass +2 -2
index 52e511f..c1de2f6 100644
@@ -308,10 +308,10 @@ def base_set_filespath(path, d):
     if extrapaths != "":
         path = extrapaths.split(":") + path
     # The ":" ensures we have an 'empty' override
-    overrides = (d.getVar("OVERRIDES", True) or "") + ":"
+    overrides = ((d.getVar("OVERRIDES", True) or "") + ":").split(":")
     for p in path:
         if p != "": 
-            for o in overrides.split(":"):
+            for o in overrides:
                 filespath.append(os.path.join(p, o))
     return ":".join(filespath)