Skip to contentSkip to conversation

[1.42 0/1] Merge request

DISCUSSION Armin Kuster 1 participant 2 messages Jan 26, 2020

lore
Share & tools
lore
#0 lore raw

Please concider this for 1.42

The following changes since commit 4ce50bbd34eefeabfeca89a6a66c71598d3c58f6:

fetch2: Ensure cached url data is matched to a datastore (2019-11-13 22:00:03 +0000)

are available in the Git repository at:

git://git.openembedded.org/bitbake-contrib stable/1.42-next
http://cgit.openembedded.org//log/?h=stable/1.42-next

Peter Kjellerstedt (1):
cooker: Keep track of watched files using a set instead of a list

 lib/bb/cooker.py | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
Signature · 1 line
2.17.1
#1 lore raw

[1.42 1/1] cooker: Keep track of watched files using a set instead of a list

From: Peter Kjellerstedt <[email protected]>

When there are many watched files, keeping track of them using lists is suboptimal. Using sets improves the performance considerably.

(cherry picked from commit 1e96df260e47d160dbd36bfc92c31ef06266f662)
---
 lib/bb/cooker.py | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
lib/bb/cooker.py +8 -8
index a97bafdc..77d18a5d 100644
@@ -171,8 +171,8 @@ class BBCooker:
         bb.debug(1, "BBCooker pyinotify1 %s" % time.time())
         sys.stdout.flush()
 
-        self.configwatcher.bbseen = []
-        self.configwatcher.bbwatchedfiles = []
+        self.configwatcher.bbseen = set()
+        self.configwatcher.bbwatchedfiles = set()
         self.confignotifier = pyinotify.Notifier(self.configwatcher, self.config_notifications)
         bb.debug(1, "BBCooker pyinotify2 %s" % time.time())
         sys.stdout.flush()
@@ -182,8 +182,8 @@ class BBCooker:
         self.watcher = pyinotify.WatchManager()
         bb.debug(1, "BBCooker pyinotify3 %s" % time.time())
         sys.stdout.flush()
-        self.watcher.bbseen = []
-        self.watcher.bbwatchedfiles = []
+        self.watcher.bbseen = set()
+        self.watcher.bbwatchedfiles = set()
         self.notifier = pyinotify.Notifier(self.watcher, self.notifications)
 
         bb.debug(1, "BBCooker pyinotify complete %s" % time.time())
@@ -278,14 +278,14 @@ class BBCooker:
         if not watcher:
             watcher = self.watcher
         for i in deps:
-            watcher.bbwatchedfiles.append(i[0])
+            watcher.bbwatchedfiles.add(i[0])
             if dirs:
                 f = i[0]
             else:
                 f = os.path.dirname(i[0])
             if f in watcher.bbseen:
                 continue
-            watcher.bbseen.append(f)
+            watcher.bbseen.add(f)
             watchtarget = None
             while True:
                 # We try and add watches for files that don't exist but if they did, would influence
@@ -294,7 +294,7 @@ class BBCooker:
                 try:
                     watcher.add_watch(f, self.watchmask, quiet=False)
                     if watchtarget:
-                        watcher.bbwatchedfiles.append(watchtarget)
+                        watcher.bbwatchedfiles.add(watchtarget)
                     break
                 except pyinotify.WatchManagerError as e:
                     if 'ENOENT' in str(e):
@@ -302,7 +302,7 @@ class BBCooker:
                         f = os.path.dirname(f)
                         if f in watcher.bbseen:
                             break
-                        watcher.bbseen.append(f)
+                        watcher.bbseen.add(f)
                         continue
                     if 'ENOSPC' in str(e):
                         providerlog.error("No space left on device or exceeds fs.inotify.max_user_watches?")
Signature · 1 line
2.17.1