Commits

Anonymous committed 284ba76

Fix performance regression introduced in 6bba86506e44 and 90b8be5ad4d49

These changes introduced sorting for config values, but on the other hand
decreased performance drastically by repeatedly calling the expensive
systemrcpath() function. This is fixed here by calling that function only once
and storing the value in a function attribute.

Comments (0)

Files changed (1)

     4
     """
     path = path.rsplit(":", 1)[0]
-    if path in systemrcpath():
+    if path in classifycfgpath.systemrcpath:
         return SYSTEMRC
     if util.pconvert(path).endswith(".hg/projrc"):
         return PROJRC
         return USERRC
     # .hg/hgrc, file in $HGRCPATH, or an included file
     return HGRC
+# Use a function attribute to compute this value only once.
+classifycfgpath.systemrcpath = systemrcpath()
 
 def isfilepath(pth):
     """True if a path is not an http, https or ssh path"""