Quellcode durchsuchen

"create" micro optimization: do not check for sockets early

they are rare, so it's pointless to check for them first.

seen the stat..S_ISSOCK in profiling results with high call count.
was no big issue, that call is cheap, but also no big issue to just fix the order.
Thomas Waldmann vor 10 Jahren
Ursprung
Commit
ed1e5e9c13
1 geänderte Dateien mit 3 neuen und 3 gelöschten Zeilen
  1. 3 3
      borg/archiver.py

+ 3 - 3
borg/archiver.py

@@ -168,9 +168,6 @@ Type "Yes I am sure" if you understand this and want to continue.\n""")
         # Entering a new filesystem?
         # Entering a new filesystem?
         if restrict_dev and st.st_dev != restrict_dev:
         if restrict_dev and st.st_dev != restrict_dev:
             return
             return
-        # Ignore unix sockets
-        if stat.S_ISSOCK(st.st_mode):
-            return
         status = None
         status = None
         if stat.S_ISREG(st.st_mode):
         if stat.S_ISREG(st.st_mode):
             try:
             try:
@@ -196,6 +193,9 @@ Type "Yes I am sure" if you understand this and want to continue.\n""")
             status = archive.process_fifo(path, st)
             status = archive.process_fifo(path, st)
         elif stat.S_ISCHR(st.st_mode) or stat.S_ISBLK(st.st_mode):
         elif stat.S_ISCHR(st.st_mode) or stat.S_ISBLK(st.st_mode):
             status = archive.process_dev(path, st)
             status = archive.process_dev(path, st)
+        elif stat.S_ISSOCK(st.st_mode):
+            # Ignore unix sockets
+            return
         else:
         else:
             self.print_error('Unknown file type: %s', path)
             self.print_error('Unknown file type: %s', path)
             return
             return