blob: d8af150c1077329a331e757c330a0414167d5505 (
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
|
On this wiki, editing `templates/gitbranch.mdwn` causes a really slow
refresh, orders of magnitude slower than a full rebuild: a large number of
pages depend on that template, or link to a page that embeds that template,
and so on.
I suspect that, as with my optimization pass for `album`'s benefit, the
costly thing is evaluating lots of pagespecs. I'm profiling it to see
whether the problem is there are any low-hanging fruit.
Easy to reproduce offline:
* comment out the `exclude` option in `docwiki.setup`
* `/usr/bin/perl -Iblib/lib ikiwiki.in -setup docwiki.setup -rebuild`
* `touch templates/gitbranch.mdwn`
* `/usr/bin/perl -Iblib/lib ikiwiki.in -setup docwiki.setup -refresh`
NYTProf says:
# spent 279s (237+41.8) within IkiWiki::bestlink which was called 13988949 times, avg 20µs/call:
# 13150827 times (222s+37.2s) by IkiWiki::PageSpec::match_link at line 2692, avg 20µs/call
# 829606 times (14.9s+4.51s) by IkiWiki::PageSpec::match_link at line 2687, avg 23µs/call
...
sub bestlink ($$) {
which is about half the execution time (458s on my laptop).
Adding code to log each call to match_backlink indicates that a large part
of the problem is that it evaluates the pagespec
`backlink(plugins/goodstuff)` up to a million times, with various pages and locations.
--[[smcv]]
|