Mercurial > hg
comparison hgdemandimport/__init__.py @ 45464:4a0ccbecbaa6
repo: avoid copying/updating a dict on every `repo.__getitem__`
This has some mild performance benefits. I'm looking into a pathological case
where one of our `hg log` invocations takes several seconds, and according to
hyperfine this reduces the wall time of the entire operation (running in chg)
from:
```
Time (mean ± σ): 7.390 s ± 0.106 s [User: 7.058 s, System: 0.271 s]
Range (min … max): 7.300 s … 7.625 s
```
to:
```
Time (mean ± σ): 7.046 s ± 0.091 s [User: 6.714 s, System: 0.279 s]
Range (min … max): 6.916 s … 7.169 s
```
Note: the log command is slow due to an issue in our custom stuff executing
`repo[<arg>]` 298,800 times. This performance improvement is likely not
noticeable during normal operation, but I don't feel like it's making the code
more difficult to understand, and every small bit helps.
Differential Revision: https://phab.mercurial-scm.org/D9022
author | Kyle Lippincott <spectral@google.com> |
---|---|
date | Fri, 11 Sep 2020 15:52:06 -0700 |
parents | 81b4e7c866ec |
children | 07731064ac41 |
comparison
equal
deleted
inserted
replaced
45463:145cfe84d3e4 | 45464:4a0ccbecbaa6 |
---|