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