Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-13459

Significantly improve perceptual page load times by moving Javascript to end of HTML


    • We collect Jira feedback from various sources, and we evaluate what we've collected when planning our product roadmap. To understand how this piece of feedback will be reviewed, see our Implementation of New Features Policy.

      NOTE: This suggestion is for JIRA Server. Using JIRA Cloud? See the corresponding suggestion.

      Short version: After moving Javascript references to the end of the page templates, we saw initial page render drop from approximately 12 seconds to just over 1. Shame it doesn't completely work after that...

      Long version:

      Like many people, we're currently using Jira over HTTPS. This means (as you guys have already blogged) that all JS files are loaded sequentially and not cached. The vast majority of JS files referenced are in the <head> of the page, which means it can't even start to render the body until they're all loaded. This is particularly bad for us because not only are we using a remotely-hosted Jira (and so each JS file load seems to take at least 100ms, often much more) but we've installed the Jira Labels plugin, which adds 10-15 more JS files to most pages. Hence, 12 seconds before render.

      I took the <script> tags from /includes/decorators/header.jsp and created a new javascript.jsp. (I also moved the webResourceManager.includeResources(out) call) Then I added an include of this file to footer.jsp, right before the </body>. The page was then able to render completely before most of the JS had been loaded.

      Ideally, everything should work fine after this. Unfortunately, it's not always the case - several parts of the page template use inline JS which execute as soon as they're loaded. In some cases, e.g. the auto-completing user picker, the code is referencing YUI functions which haven't been loaded yet. What the code should be doing is deferring until the page is either fully loaded (by onLoad) or, even better, the DOM is ready (see: http://dean.edwards.name/weblog/2005/09/busted/ and follow-ons).

      The speed of Jira is a major issue for us (Linden Lab); making these tweaks would be of significant value.

        1. all-inline-scripts.txt
          122 kB
        2. non-function-inline-scripts.txt
          53 kB
        3. scriptfind.pl
          0.7 kB

            Unassigned Unassigned
            721b332b5702 Yoz Grahame
            10 Vote for this issue
            12 Start watching this issue