[dokuwiki] Re: Performance: scripts at the bottom?

  • From: Mark Prins <mc.prins@xxxxxxxxx>
  • To: dokuwiki <dokuwiki@xxxxxxxxxxxxx>
  • Date: Fri, 24 May 2013 12:25:24 +0200

2013/5/24 Colin McKinnon <colin.mckinnon@xxxxxxxxx>:
> Hi all,
> I finally got fed up with Dokuwiki telling me to upgrade and bit the bullet
> (yes, I know I should have done it sooner).
> Having installed Weatherwax on my public site, I was rather relieved that
> everything worked (good job guys!). However my pages now have at least a
> half second overhead to render. On investigation I tracked this down to
> parsing the javascript. Loving the jQuery, but it's a huge performance hit.
> (Yes I am testing using recent browsers).
> By hacking around my template and the tpl_metaheaders() code a bit, I was
> able to move the javascript to the bottom of the page (using async/defer is
> not a very practical option for dependencies) and have yet to run into any
> problems using the core distribution. Of course, it takes just as long for
> the onload event to fire - but the screen renders long before this happens.
> Unfortunately, my messy hack has broken a lot of javascript powered third
> party dokuwiki plugins though (like googlemaps3).
> From what I've seen so far, it looks like untangling this will require some
> extensive surgery on dokuwiki and potentially have a big impact on backward
> compatibility.
> To get to the point:
> 1) is my assessment correct - that to do this properly will require
> significant changes to DokuWiki?

It may. As you pointed out it's largely a template thing, which is
small change, however many plugins use an action plugin to append
script elements to the head element of a page, ie. they listen for the
TPL_METAHEADER_OUTPUT event as described in

Currently I don't think (I may well be wrong here) that there is any
event that you can attach to which signals the (before the) end of the
body element rendering and allows easy insertion of script elements as
TPL_METAHEADER_OUTPUT  does, for fixing the plugins I think this would
be required, and could be a big change.
As a side effect having javascript modify the page after loading may
cause reflows of the page content, this could probably also  be fixed
in the plugins though.


This message is just a reflection of what I thought at the time of
sending. The message may contain information that is not intended for
you or that you don't understand.
DokuWiki mailing list - more info at

Other related posts: