aboutsummaryrefslogtreecommitdiff
path: root/doc/bugs/editing_gitbranch_template_is_really_slow.mdwn
diff options
context:
space:
mode:
authorhttp://smcv.pseudorandom.co.uk/ <smcv@web>2014-03-03 07:44:31 -0400
committeradmin <admin@branchable.com>2014-03-03 07:44:31 -0400
commit3ce7d8bfb822cf253724cc3677e54fad5aeb1e2b (patch)
treed5f35b0082fe7bb018286b70686ae88ca55f66a4 /doc/bugs/editing_gitbranch_template_is_really_slow.mdwn
parent8142406c3121967289c38152c5bed5141780be48 (diff)
downloadikiwiki-3ce7d8bfb822cf253724cc3677e54fad5aeb1e2b.tar
ikiwiki-3ce7d8bfb822cf253724cc3677e54fad5aeb1e2b.tar.gz
an order-of-magnitude optimization which also improves correctness
Diffstat (limited to 'doc/bugs/editing_gitbranch_template_is_really_slow.mdwn')
-rw-r--r--doc/bugs/editing_gitbranch_template_is_really_slow.mdwn34
1 files changed, 34 insertions, 0 deletions
diff --git a/doc/bugs/editing_gitbranch_template_is_really_slow.mdwn b/doc/bugs/editing_gitbranch_template_is_really_slow.mdwn
index d8af150c1..57fdbbf4e 100644
--- a/doc/bugs/editing_gitbranch_template_is_really_slow.mdwn
+++ b/doc/bugs/editing_gitbranch_template_is_really_slow.mdwn
@@ -29,3 +29,37 @@ of the problem is that it evaluates the pagespec
`backlink(plugins/goodstuff)` up to a million times, with various pages and locations.
--[[smcv]]
+
+> [[!template id=gitbranch branch=smcv/ready/perf
+author="[[Simon McVittie|smcv]]"
+browse=http://git.pseudorandom.co.uk/smcv/ikiwiki.git/shortlog/refs/heads/ready/perf]]
+> [[!tag patch]]
+>
+> Previously, if a page like `plugins/trail` contained a conditional like
+>
+> [[!if test="backlink(plugins/goodstuff)" all=no]]
+>
+> (which it gets via `templates/gitbranch`), then the
+> [[plugins/conditional]] plugin would give `plugins/trail` a dependency on
+> `(backlink(plugins/goodstuff)) and plugins/trail`. This dependency is
+> useless: that pagespec can never match any page other than
+> `plugins/trail`, but if `plugins/trail` has been modified or deleted,
+> then it's going to be rendered or deleted *anyway*, so there's no point
+> in spending time evaluating match_backlink for it.
+>
+> Conversely, the influences from the result were not taken into account,
+> so `plugins/trail` did not have the
+> `{ "plugins/goodstuff" => $DEPEND_LINKS }` dependency that it should.
+>
+> We should invert that, depending on the influences but not on the test.
+>
+> This is at least an order of magnitude faster: when I edit the docwiki
+> as described above, a refresh takes 37s with nytprof overhead, compared
+> with 458s with nytprof overhead before this change. Without nytprof,
+> that refresh takes 14s, which is faster than the 24s rebuild again.
+> I didn't record how long the refresh took without nytprof before this
+> change, but it was something like 200s.
+>
+> `bestlink` is still the single most expensive function in this refresh
+> at ~ 9.5s, with `match_glob` at ~ 5.2s as the runner-up.
+> --[[smcv]]