diff contrib/perf.py @ 47482:eb416759af7e

dirstate: Removed unused instances of `DirsMultiset` ? in Rust-backed dirstatemap. The Python class `dirstatemap` had cached properties `_dirs` and `_alldirs` that were not used for `hastrackeddir` and `hasdir` since they were redundant with corresponding fields for the Rust `DirstateMap` struct. `dirfoldmap` is modified to reuse instead the directory iterator introduced in 3b9914b28133c0918186b6e8b9e4f1916e21338d. Differential Revision: https://phab.mercurial-scm.org/D10921
author Simon Sapin <simon.sapin@octobus.net>
date Mon, 28 Jun 2021 15:52:10 +0200
parents 8d3c2f9d4af7
children 6000f5b25c9b
line wrap: on
line diff
--- a/contrib/perf.py	Mon Jun 28 15:41:50 2021 +0200
+++ b/contrib/perf.py	Mon Jun 28 15:52:10 2021 +0200
@@ -1147,7 +1147,10 @@
 
     def d():
         dirstate.hasdir(b'a')
-        del dirstate._map._dirs
+        try:
+            del dirstate._map._dirs
+        except AttributeError:
+            pass
 
     timer(d)
     fm.end()
@@ -1225,7 +1228,10 @@
     repo.dirstate.hasdir(b"a")
 
     def setup():
-        del repo.dirstate._map._dirs
+        try:
+            del repo.dirstate._map._dirs
+        except AttributeError:
+            pass
 
     def d():
         repo.dirstate.hasdir(b"a")
@@ -1268,7 +1274,10 @@
 
     def setup():
         del dirstate._map.dirfoldmap
-        del dirstate._map._dirs
+        try:
+            del dirstate._map._dirs
+        except AttributeError:
+            pass
 
     def d():
         dirstate._map.dirfoldmap.get(b'a')