aboutsummaryrefslogtreecommitdiff
path: root/doc/todo/could_standalone___39__fixed__39___git-annex_binaries_be_prelinked__63__/comment_1_1bdc41c22f472d1d6adac563952fe354._comment
blob: 7ec438147c399c2eb9cb5f41270d86024f1137db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
[[!comment format=mdwn
 username="joey"
 subject="""comment 1"""
 date="2016-07-06T15:59:34Z"
 content="""
Startup time is also particulary important when git-annex is being used as
a smudge/clean filter in v6 mode, since it's run once per file git operates
on.

---

What I'd look at before prelinking is, does your git-annex executable
dynamically link haskell libraries?

That was the case for a while in the standalone builds, until I noticed it
caused too much linker time and put it back to static linking of the
haskell libs. Leaving only 34 or so C shared libs.

---

Did some preliminary benchmarking here of `git-annex version --raw`

* deb package build: 0.04 seconds min
* deb package build prelinked: ~0.03 seconds min
* standalone build: 0.05 seconds min
* git-annex modified to print "hi" and exit immediately: 0.02 seconds min

So, the overhead of the wrapper scripts for the standalone build is around
0.01 seconds.

And, prelinking does help a little bit (although probably closer to 0.005
seconds than 0.01; my measurements are too coarse to get a good number).

Meanwhile, 0.02 seconds are used after git-annex starts up. This overhead
includes finding the path to the git repository, running and parsing `git
config --list`, etc.

But what about that 0.02 seconds just to print "hi"...?

----

With strace I noticed a very interesting thing. Despite being statically
linked against the haskell libraries, the linker searches in all their
paths for all C libraries. This adds around 30000 failed open() calls
to git-annex's startup. This is done even after prelinking. It must be a
significant part of the startup time.

Filed a bug: <https://github.com/haskell/cabal/issues/3524>

Put in a chrpath workaround, but only when git-annex is built with "make"
(not cabal install git-annex).

Updated benchmarks:

* deb package build: 0.02 seconds min
* deb package build prelinked: ~0.02 seconds min
* standalone build: 0.03 seconds min
* git-annex modified to print "hi" and exit immediately: 0.01 seconds min
"""]]