py-heptapod merge requestshttps://foss.heptapod.net/heptapod/py-heptapod/-/merge_requests2022-01-18T13:18:44Zhttps://foss.heptapod.net/heptapod/py-heptapod/-/merge_requests/40Take over single head enforcement, plus refactorings2022-01-18T13:18:44ZGeorges RacinetTake over single head enforcement, plus refactoringspy-heptapod had all the needed information to enforce single heads itself if required, avoiding to call the expensive
`_filter_obsolete_heads` twice.
In the current stable Heptapod 0.17 series (py-heptapod 1.1), we don't change the inte...py-heptapod had all the needed information to enforce single heads itself if required, avoiding to call the expensive
`_filter_obsolete_heads` twice.
In the current stable Heptapod 0.17 series (py-heptapod 1.1), we don't change the interpretation of configuration. We will
do cleaner and better for the future 0.18.
This brings the expected performance improvement on heptapod#351, at least on my reproduction case.
A simple push to the locally remounted mercurial-devel project goes down from 22s to 13s. for almost a 40% improvement.
```
hg push -r s2 --debug 2.48s user 0.29s system 12% cpu 22.289 total # before
hg push -r s3 --debug 2.45s user 0.26s system 19% cpu 13.838 total # after
```
Before the change, here are some interesting timings from the logs:
```
[2020-11-28 22:18:20 +0100] [3073842] [DEBUG] repo:some/path.hg [hg] user b'heptapod-publish' is allowed by web.allow-push=[heptapod-write, heptapod-publish]
[2020-11-28 22:18:28 +0100] [3073842] [INFO] repo:some/path.hg [hg] Heptapod mirror starting
[2020-11-28 22:18:35 +0100] [3073842] [INFO] repo:some/path.hg [hg] heptapod_notify_gitlab heptapod.native=False
```
Between the first and second line, that's the time in general Mercurial treatment (Heptapod mirroring occurs at the end of transaction). At the third time, mirroring is essentially done. The time that remains is spent notifying GitLab and closing the transaction (that is negligible in proportion).
Hence we have 8s before the Heptapod mirroring kicks in and 7s in the mirroring.
After the change:
```
[2020-11-28 22:28:58 +0100] [3074921] [DEBUG] repo:some/path.hg [hg] user b'heptapod-publish' is allowed by web.allow-push=[heptapod-write, heptapod-publish]
[2020-11-28 22:28:59 +0100] [3074921] [INFO] repo:some/path.hg [hg] Heptapod mirror starting
[2020-11-28 22:29:06 +0100] [3074921] [INFO] repo:some/path.hg [hg] heptapod_notify_gitlab heptapod.native=False
```
The time spent before the mirroring starts went down to 1s. That is were we removed the duplicate call to `_filter_obsolete_heads`.
In short `_filter_obsolete_heads` did account for three quarters of the total push time (including obsmarker exchanges etc.). After the change, it is still worth half the improved total time.Heptapod 0.17.2