Mercurial > hg
comparison contrib/perf.py @ 47477: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 |
comparison
equal
deleted
inserted
replaced
47476:f23eafb036af | 47477:eb416759af7e |
---|---|
1145 dirstate = repo.dirstate | 1145 dirstate = repo.dirstate |
1146 b'a' in dirstate | 1146 b'a' in dirstate |
1147 | 1147 |
1148 def d(): | 1148 def d(): |
1149 dirstate.hasdir(b'a') | 1149 dirstate.hasdir(b'a') |
1150 del dirstate._map._dirs | 1150 try: |
1151 del dirstate._map._dirs | |
1152 except AttributeError: | |
1153 pass | |
1151 | 1154 |
1152 timer(d) | 1155 timer(d) |
1153 fm.end() | 1156 fm.end() |
1154 | 1157 |
1155 | 1158 |
1223 opts = _byteskwargs(opts) | 1226 opts = _byteskwargs(opts) |
1224 timer, fm = gettimer(ui, opts) | 1227 timer, fm = gettimer(ui, opts) |
1225 repo.dirstate.hasdir(b"a") | 1228 repo.dirstate.hasdir(b"a") |
1226 | 1229 |
1227 def setup(): | 1230 def setup(): |
1228 del repo.dirstate._map._dirs | 1231 try: |
1232 del repo.dirstate._map._dirs | |
1233 except AttributeError: | |
1234 pass | |
1229 | 1235 |
1230 def d(): | 1236 def d(): |
1231 repo.dirstate.hasdir(b"a") | 1237 repo.dirstate.hasdir(b"a") |
1232 | 1238 |
1233 timer(d, setup=setup) | 1239 timer(d, setup=setup) |
1266 dirstate = repo.dirstate | 1272 dirstate = repo.dirstate |
1267 dirstate._map.dirfoldmap.get(b'a') | 1273 dirstate._map.dirfoldmap.get(b'a') |
1268 | 1274 |
1269 def setup(): | 1275 def setup(): |
1270 del dirstate._map.dirfoldmap | 1276 del dirstate._map.dirfoldmap |
1271 del dirstate._map._dirs | 1277 try: |
1278 del dirstate._map._dirs | |
1279 except AttributeError: | |
1280 pass | |
1272 | 1281 |
1273 def d(): | 1282 def d(): |
1274 dirstate._map.dirfoldmap.get(b'a') | 1283 dirstate._map.dirfoldmap.get(b'a') |
1275 | 1284 |
1276 timer(d, setup=setup) | 1285 timer(d, setup=setup) |